Eclipse error with binding dependencies

I am developing a binding and need jsoup as a dependency. First I installed eclipse and the respective openhab development environment using the guide. As jsoup is also used in other bindings I tried to import it as a shared dependency like suggested in the documentation, by modifying the pom.xml and feature.xml like it is done in other bindings like this one.


pom.xml


<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.14.3</version>
<scope>provided</scope>
</dependency>


feature.xml


<bundle dependency=“true”>mvn:org.jsoup/jsoup/1.14.3</bundle>

I then proceeded to add the binding to the run requirements and press “Resolve”, which throws an error message:

Resolution failed. Capabilities satisfying the following requirements could not be found:
[<<INITIAL>>]
⇒ osgi.identity: (osgi.identity=org.openhab.binding.MY_BINDING)
⇒ [org.openhab.binding.MY_BINDING version=3.3.0.202204241433]
⇒ osgi.wiring.package: (&(osgi.wiring.package=org.jsoup)(version>=1.14.0)(!(version>=2.0.0)))
[org.apache.karaf.kar.core version=4.3.6]
⇒ osgi.service: (objectClass=org.apache.karaf.features.FeaturesService)

This not only happens with my binding but also with the other one I mentioned above, suggesting that it has something to do with eclipse / the environment.
I also tried a fresh install eclipse on both Linux and Win10.
Thanks for your help.

Hi,
I also use jsoup in bindings, but I use to add org.jsoup to Run Bundles instead of Run Requirements.
Please try,
Br Basse

By using the provided scope and feature.xml the jsoup library is dynamically installed when installing the binding. Then the binding jar of your binding is smaller, because it doesn’t contain the jsoup library. If multiple bindings use this library, and the library is not small this can be the preferred way. However when using provided you need to add the jsoup dependency also to the demo pom.xml and also drag the library in the app.bndrun, like you did with your binding.

If you remove scope provided the adding of the dependency to the demo pom.xml is not needed. You then also should remove jsoup from the feature.xml. Removal from the feature.xml is only relevant for when you deploy the jar file to an openHAB installation.

2 Likes

Thanks really much, that did it

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.