[SOLVED] Migrating binding to new development environment: Unable to resolve root

Working on migrating a binding into the new development environment (using Eclipse IDE). However, after following tutorial, running mvn clean install generates some errors:

[ERROR] Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.2.6:verify (karaf-feature-verification) on project org.openhab.binding.<MyBinding>: Feature resolution failed for [openhab-binding-<MyBinding>/2.5.0.SNAPSHOT]
[ERROR] Message: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=openhab-binding-<MyBinding>; type=karaf.feature; version=2.5.0.SNAPSHOT; filter:="(&(osgi.identity=openhab-binding-<MyBinding>)(type=karaf.feature)(version>=2.5.0.SNAPSHOT))" [caused by: Unable to resolve openhab-binding-<MyBinding>/2.5.0.SNAPSHOT: missing requirement [openhab-binding-<MyBinding>/2.5.0.SNAPSHOT] osgi.identity; osgi.identity=org.openhab.binding.<MyBinding>; type=osgi.bundle; version="[2.5.0.201909182021,2.5.0.201909182021]"; resolution:=mandatory [caused by: Unable to resolve org.openhab.binding.<MyBinding>/2.5.0.201909182021: missing requirement [org.openhab.binding.<MyBinding>/2.5.0.201909182021] osgi.wiring.package; filter:="(osgi.wiring.package=org.glassfish.tyrus.container.grizzly.server)"]]
[ERROR] Repositories: {
..
..
..

Any hints?

Looks like you use a library that isn’t correctly included in your binding. The tutorial has a link to the documentation that describes how to include an additional library,. Both how to include in your pom as well as in your binding feature file. If that doesn’t help please post your pom / feature file.

Yes, tried to update dependency to the mentioned org.glassfish.tyrus.container.grizzly.server (being reported in the error), both in the pom file and in the feature file (library from mvn repository).

Still getting error for the same library, but now there is some additonal reference to some version, but not related to the library version itself:

[ERROR] Message: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=openhab-binding-freeathome; type=karaf.feature; version=2.5.0.SNAPSHOT; filter:="(&(osgi.identity=openhab-binding-freeathome)(type=karaf.feature)(version>=2.5.0.SNAPSHOT))" [caused by: Unable to resolve openhab-binding-freeathome/2.5.0.SNAPSHOT: missing requirement [openhab-binding-freeathome/2.5.0.SNAPSHOT] osgi.identity; osgi.identity=org.openhab.binding.freeathome; type=osgi.bundle; version="[2.5.0.201909191512,2.5.0.201909191512]"; resolution:=mandatory [caused by: Unable to resolve org.openhab.binding.freeathome/2.5.0.201909191512: missing requirement [org.openhab.binding.freeathome/2.5.0.201909191512] osgi.wiring.package; filter:="(&(osgi.wiring.package=org.glassfish.tyrus.container.grizzly.server)(version>=1.15.0)(!(version>=2.0.0)))" [caused by: Unable to resolve org.glassfish.tyrus.container-grizzly-server/1.15.0: missing requirement [org.glassfish.tyrus.container-grizzly-server/1.15.0] osgi.wiring.package; filter:="(&(osgi.wiring.package=org.glassfish.grizzly)(version>=2.4.0)(!(version>=3.0.0)))"]]]

Have pushed the migrated binding (so far) to github, so hopefully someone sees an easy fix from the code:

https://github.com/kjoglum/openhab2-addons/tree/master/bundles/org.openhab.binding.freeathome

Well, getting along without necessarily becoming any wiser…

So, apparently, I managed to combat some of these errors by including bundle dependency in my pom file, AND by re-adding corresponding bundles (jar files) to my /lib folder. Have no clue if this is the recommended approach, however, it seems to take away some of the errors. Would be interesting to know by standard, which files are required to go in the /lib folder and which should be included in the Referenced Library (build path).

However, getting along down the debugging path, I now get a new error message, still relating to Missing Requirement...osgi.wiring.package, but now the missing package is com.sun.logging (which is included in the JRE library).

Any tips on the way would be highly appreciated.

The recommend approach is to let maven handle as much libraries as possible. However this doesn’t always play nice. Specifically if some other binding or core uses a different version of that library. There is still some work being done on how we would best work with libraries not included in core. There were several pull request with tests on openHAB2-addons. If you put a library in the lib folder it should not be mentioned in the feature.xml and also not in the pom.xml. For testing this might be the easiest route. If you still have resolution problems for dependencies that are not used, but required because the library you use has a dependency on it even if you don’t use that part of the library. You can always use a brute force method by putting the missing package in the blacklist of app.bndrun. Open the app.bndrun, goto source (left corner of the pane in Eclipse) and add the package to the blacklist. This is probably not the cleanest solution. But should get you going.

Appreciate your guidance and time. Highly useful (and required) for rookies to try to learn and adapt.

I am implementing the required external libraries (jar files) into /lib sequentially based on appearance from errors, including them into build path (excluding them from pom / feature). However, as these are libraries primarily retrieved from mvnrepository, they also include test dependencies by default, and I end up with an unresolved error regardless due to a test dependency which is not required for for the binding I am working on (com.sun.logging, android.os etc).

Have tried blacklisting the requested packages from app.bndrun but the error/unable to reseolve issue remains.

Seem to be stuck, so any guidance for further progress would be appreciated!

Managed to identify missing/required library android-util, and downloaded jar file and implemented in /lib folder and added to build path.

So now, finally, I have a working/resolved binding (free of errors) within the new OpenHab development environment.