Have a custom binding/addon running perfectly under openHAB 2.5.x (currently 2.5.10). The addon uses XMPP over websocket covered by the XMPP.rocks library (maven repository). As the gateway, which the addon is connected to, is not following official websocket protocol, the XMPP.rocks library has been customized, and the customized version of the library is included in the /lib folder of the addon. Maven builds are running without failure, and addon is running successfully.
I have also managed to migrate the addon for OH 3.0 (Java 11), and initially maven builds were running without failure, and the addon was running with success on “early” 3.0 environment.
Although, after a rebase to the latest 3.0 version, maven builds are failing for my addon: I now get a lot of errors stating “import class cannot be resolved to type”. Classes then being present in the /lib folder.
Not necessarily - you can install your library manually through install file:/home/openhabian/myxmpp-fixed.jar command. You can also wrap xmpp within your binding, probably doubling its size (hint: add it to Export-Package or Private-Package header in bnd file).
For the short term. Just compile the library and install it locally with mvn install. Give the library a unqiue new version number. Next include the library in your binding pom.xml with scope compile. This will cause the library to be packaged jnto your binding jar. This will make it work for the the time being. When you later want to make a pull request it need to be worked out how to make the library available online.
Could not resolve dependencies for project org.openhab.addons.bundles:org.openhab.binding.freeathome:jar:3.0.0-SNAPSHOT: The following artifacts could not be resolved: rocks.xmpp:xmpp-websocket-client-modified:jar:0.8.2.x, rocks.xmpp:xmpp-websocket-common-modified:jar:0.8.2.x: Could not find artifact rocks.xmpp:xmpp-websocket-client-modified:jar:0.8.2.x in openhab-release (https://openhab.jfrog.io/openhab/libs-release)
Check what is in your m2 repository. It must contain the jar and pom file matching with the library and version you want to include. If it doesn’t match or is a different version maven will try to download and that is what it will report: the download failed.
You are perfectly right. Deleted the local m2 repository, and did a fresh mvn install both for my library and my bundle, and now my bundle builds with success with library dependencies from the local m2 folder.