[SOLVED] Problems with maven dependencies and bnd

I am currently preparing the Volumio2 binding to be mergable with openhab-addons. (again) So I am trying to adopt the maven/bnd build system. I am currently failing in integrating the dependencies of the binding. (Socket.io).

I´ve read around the forum and had a look at other bindings… and after a while I found org.openhab.io.openhabcloud and it´s way to integrate socket.io through pom.xml. I´ve build the openhabcloud binding and installed it into my openhab dist. and it´s also failing with the following message:

2019-06-03 12:17:49.593 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/d/dev/oh2/openhab2-base/addons/org.openhab.io.openhabcloud-2.5.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.io.openhabcloud [202]
  Unresolved requirement: Import-Package: io.socket.client

	at org.eclipse.osgi.container.Module.start(Module.java:444) ~[?:?]
	at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) ~[?:?]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [10:org.apache.felix.fileinstall:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [10:org.apache.felix.fileinstall:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520) [10:org.apache.felix.fileinstall:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [10:org.apache.felix.fileinstall:3.6.4]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [10:org.apache.felix.fileinstall:3.6.4]
2019-06-03 12:21:59.551 [INFO ] [.dashboard.internal.DashboardService] - Stopped Dashboard

Is this a current snapshot problem… or am I doing something wrong. So it´s failing for volumio2 binding and the openhabcloud binding. And the only thing in common is me :stuck_out_tongue_winking_eye: so I guess it´s my fault… and I am doing something wrong.

Maybe someone can have a look at this… https://github.com/patrickse/openhab2-addons/tree/volumio2-remerge/bundles/org.openhab.binding.volumio2

cheers patrick

Karaf only installs the dependencies when you install add-on features via the UI (or feature:install on the Karaf console). When you add a single JAR in the /addons dir, Karaf doesn’t have any feature information so it also doesn’t know what dependencies to install. If you use the same dependencies+versions as the openhabcloud add-on uses, it will probably work if you first install openhabcloud and then add your own binding JAR to the /addons dir.

Ah ok… got it… Thanks I will try this later :wink:

@wborn Kai mentioned to me that he sees .jar support and the addons directory as a legacy. Should we maybe build .kar files per default or additionally instead?

It´s ok for me. I am just searching a way to deploy maven build extension with dependencies to openhab. I´ve just tried the hint with feature:add-repo … and I am still failing. I guess I will need a bit time to get more into karaf/bnd … and this stuff.

Can you guys point me to a good lecture?

That’s the point of .kar files: They are .jar files plus the feature.xml file of your addon, that describes to karaf all transitive dependencies.

I only know the official Apache Karaf website. There are not many examples in their documentation and they left out the part of IDE development (they seem to develop on the command line apparently).

Wow - really? Our maven build doesn’t have the ability to build .kar files right? (so I’d have to follow something like https://karaf.apache.org/manual/latest/kar to build one). We are struggling with this exact issue over on the sony thread as well.

I think you can build a kar with mvn karaf:kar. It looks ok for me… still need to verify if the kar file loads fine.

@David_Graeff it looks like the kar contains the dependency jar… is this ok?

At least my bundle is now loaded… still some error messages … but finally some progress :wink:

1 Like

Thanks - that totally worked (atleast on a clean 2.5 instance). Doing the mvn karaf:kar did result in a warning message about the packaging not being correct (but it’s only a warning - so no big deal). When I dropped the kar file into the addons directory - I got a whole bunch of dependency errors in the log (about artifacts not being found) but after about 3 minutes - everything came online (must have been downloading the various features).

Thanks!

Yes that’s normal. The apache guys are weird sometimes. First Karaf prints those warnings and after that it notices that it can download all those missing dependencies.

And yes it takes a few moments, unfortunately Karaf has no progress indicator for dependency downloading.

Yeah - i figured as much (that’s why I waited it out). Didn’t expect a progress indicator but was hoping for some info level “Resolving …” type of messages (might be in debug but I didn’t have that on at the time). Oh well - still worked…

I am using the following command for my binding mvn clean install karaf:kar. I guess without the install goal the binding won’t be compiled…

Hi,

I’ve tried a few things but I just can’t get my binding to work.
Does anyone have an idea which dependencies or libraryies are still missing?

Thanks in advance.

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

Same here :confused:

Maybe this one?

1 Like

@patrickse

yes, I also read the error message :wink:
But which library is needed and how exactly does the depencies entry have to be?
I have tried this depency - unfortunately without success.

<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>1.9.74</version>