Binding dependencies resolving

Hello,
I’m trying to create a binding to crawl WebDAV. I try to use sardine.
I added it to my pom.xml :

  <dependencies>
  	<dependency>
  		<groupId>com.github.lookfirst</groupId>
  		<artifactId>sardine</artifactId>
  		<version>5.9</version>
	      <scope>compile</scope>
  	</dependency>
  </dependencies>

Dependencies of sardine are :

  • httpclient v4.51
    ** httpcore 4.4.3
    ** commons-codec 1.9
    ** commons-logging 1.2

I do not know how to properly bundle all this. Whatever combination I use, I fail on mvn install with a message of this kind :

[ERROR] Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.2.4:verify (karaf-feature-verification) on project org.openhab.binding.glh: Feature resolution failed for [openhab-binding-glh/2.5.0.SNAPSHOT]
[ERROR] Message: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=openhab-binding-glh; type=karaf.feature; version=2.5.0.SNAP[ERROR] Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.2.4:verify (karaf-feature-verification) on project org.openhab.binding.glh: Feature resolution failed for [openhab-binding-glh/2.5.0.SNAPSHOT]
[ERROR] Message: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=openhab-binding-glh; type=karaf.feature; version=2.5.0.SNAPSHOT; filter:="(&(osgi.identity=openhab-binding-glh)(type=karaf.feature)(version>=2.5.0.SNAPSHOT))" [caused by: Unable to resolve openhab-binding-glh/2.5.0.SNAPSHOT: missing requirement [openhab-binding-glh/2.5.0.SNAPSHOT] osgi.identity; osgi.identity=org.openhab.binding.glh; type=osgi.bundle; version="[2.5.0.201911041504,2.5.0.201911041504]"; resolution:=mandatory [caused by: Unable to resolve org.openhab.binding.glh/2.5.0.201911041504: missing requirement [org.openhab.binding.glh/2.5.0.201911041504] osgi.wiring.package; filter:="(osgi.wiring.package=com.github.sardine)"]]
SHOT; filter:="(&(osgi.identity=openhab-binding-glh)(type=karaf.feature)(version>=2.5.0.SNAPSHOT))" [caused by: Unable to resolve openhab-binding-glh/2.5.0.SNAPSHOT: missing requirement [openhab-binding-glh/2.5.0.SNAPSHOT] osgi.identity; osgi.identity=org.openhab.binding.glh; type=osgi.bundle; version="[2.5.0.201911041504,2.5.0.201911041504]"; resolution:=mandatory [caused by: Unable to resolve org.openhab.binding.glh/2.5.0.201911041504: missing requirement [org.openhab.binding.glh/2.5.0.201911041504] osgi.wiring.package; filter:="(osgi.wiring.package=com.github.sardine)"]]

I tried many variations (jar provided in lib + classpath declaration, declaring all dependencies, using noembedding) without success.

Can someone help ?
Thanks

If you use the dependeny above you should not see com.github.sardine in the import statement of the generated MANIFEST.MF (you can check that in the target folder). Can you either point me to your source code or post the manifest?

1 Like

Hello @J-N-K, I’ve tried to progress but with no luck. So I’m back to you.
Here’s the link to my code .
Thanks for your help. I’m completely lost between pom, features, bom, appbnd.run …

Try adding the transport bundle as dependency bundle before

And change the scope of the transport bundle to provided in the glh/pom.xml

The bundle sardine @glhopital is using does not export any classes (looking into the jar’s MANIFEST.MF). From my experiences in dependency hell this could be the issue, as the class can’t be resolved. According to Buildsystem docs the solution would be to wrap the library. @J-N-K: is wrapping still possible (as the dependency handling did change)?

Modifications made (source updated), no change but BTW, right now I’m only trying to
mvn -U clean install
in org.openhab.io.transport.webdav folder and I fail on :

INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  35.762 s
[INFO] Finished at: 2019-11-12T14:23:13+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.2.6:verify (karaf-feature-verification) on project org.openhab.io.transport.webdav: Feature resolution failed for [openhab-transport-webdav/2.5.0.SNAPSHOT]
[ERROR] Message: org.apache.karaf.features.internal.util.MultiException: Error:
[ERROR] 	Unable to create resource for bundle mvn:com.github.lookfirst/sardine/5.9
[ERROR] Repositories: {
[ERROR] 	file:/home/glhopital/openhab-master/git/openhab2-addons/bundles/org.openhab.io.transport.webdav/target/feature/feature.xml
[ERROR] 	mvn:org.apache.karaf.features/framework/4.2.6/xml/features
[ERROR] 	mvn:org.apache.karaf.features/standard/4.2.6/xml/features
[ERROR] 	mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/2.5.0-SNAPSHOT/xml/features
[ERROR] 	mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-tp/2.5.0-SNAPSHOT/xml/features
[ERROR] 	mvn:org.ops4j.pax.web/pax-web-features/7.2.10/xml/features
[ERROR] }
[ERROR] Resources: {
[ERROR] 	mvn:com.github.lookfirst/sardine/5.9
[ERROR] 	mvn:org.apache.felix/org.apache.felix.configadmin/1.9.14
[ERROR] 	mvn:org.apache.felix/org.apache.felix.coordinator/1.0.2
[ERROR] 	mvn:org.apache.felix/org.apache.felix.fileinstall/3.6.4
[ERROR] 	mvn:org.apache.karaf.features/org.apache.karaf.features.core/4.2.6
[ERROR] 	mvn:org.apache.karaf.features/org.apache.karaf.features.extension/4.2.6
[ERROR] 	mvn:org.apache.karaf.jaas/org.apache.karaf.jaas.boot/4.2.6
[ERROR] 	mvn:org.apache.karaf.shell/org.apache.karaf.shell.commands/4.2.6
[ERROR] 	mvn:org.apache.karaf.shell/org.apache.karaf.shell.core/4.2.6
[ERROR] 	mvn:org.apache.karaf.wrapper/org.apache.karaf.wrapper.core/4.2.6
[ERROR] 	mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.activation-api-1.1/2.9.0
[ERROR] 	mvn:org.apache.servicemix.specs/org.apache.servicemix.specs.jaxb-api-2.2/2.9.0
[ERROR] 	mvn:org.fusesource.jansi/jansi/1.18
[ERROR] 	mvn:org.jline/jline-builtins/3.11.0
[ERROR] 	mvn:org.jline/jline-reader/3.11.0
[ERROR] 	mvn:org.jline/jline-terminal-jansi/3.11.0
[ERROR] 	mvn:org.jline/jline-terminal/3.11.0
[ERROR] 	mvn:org.openhab.addons.bundles/org.openhab.io.transport.webdav/2.5.0-SNAPSHOT
[ERROR] 	mvn:org.ops4j.pax.logging/pax-logging-api/1.10.2
[ERROR] 	mvn:org.ops4j.pax.logging/pax-logging-log4j2/1.10.2
[ERROR] 	mvn:org.ops4j.pax.url/pax-url-aether/2.6.1
[ERROR] }

@J-N-K: I found a wrapper project here. Can this be used ?

No need to. I created https://github.com/clinique/openhab2-addons/pull/2 which should solve your issues. (actually I also added your new bundles to the bom, which is technically not needed to make it compile but for merging it to master later). There is a small issue with jetty (see https://github.com/openhab/openhab-core/issues/1207) which should IMO be solved in core. We can also add the missing bundle to your feature but I fear that other will run into the same issue later.

The transport bundles now compiles & resolved, the binding complains about uncatched exceptions. I did not look into that, if there are further problems, please ping me.

1 Like

Thanks a lot for your help @J-N-K ! I think I’ll be able to resume in progress now.

@J-N-K : thanks for your elements. I restarted work with this and I’m nearly headed.
I redefined two modules :
io.transport.webdav (that compiles fine),
and
binding.cardbook where I still have a sardine dependency issue :

[ERROR] Message: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=openhab-binding-cardbook; type=karaf.feature; version=2.5.0.SNAPSHOT; filter:="(&(osgi.identity=openhab-binding-cardbook)(type=karaf.feature)(version>=2.5.0.SNAPSHOT))" [caused by: Unable to resolve openhab-binding-cardbook/2.5.0.SNAPSHOT: missing requirement [openhab-binding-cardbook/2.5.0.SNAPSHOT] osgi.identity; osgi.identity=org.openhab.binding.cardbook; type=osgi.bundle; version="[2.5.0.201911131524,2.5.0.201911131524]"; resolution:=mandatory [caused by: Unable to resolve org.openhab.binding.cardbook/2.5.0.201911131524: missing requirement [org.openhab.binding.cardbook/2.5.0.201911131524] osgi.wiring.package; filter:="(osgi.wiring.package=com.github.sardine)"]]

I even tried to wrap the DavResource class coming from Sardine without any success.
Can I ask help once again ?

Thanks

I guess the dependency of your binding also depends on sardine. This can be solved, but is either a little bit tricky or simple and ugly.

Why do you add a transport bundle? Do you think there will be other bindings that use the transport bundle in the future?

Yes, Webdav is also used by Caldav (v1 binding uses Sardine), reason why I try to do it this way.
Here’s the beginning of this journey.

In my last version, I tried to isolate sardine as much as possible in the transport bundle, so I do not understand where some transitive dependency leads carddav to need Sardine.

Ok. I‘ll check that