Dependency problem with maven

Hi Guys,
I’m a new Java programmer (I hava 15+ years of experience in C and other languages) and I’m experiencing some problem building my first binding.

Everything seems working with the eclipse demo app and I can debug my code, but, once I change the item state the OFF command is not sended to my channel (ON command is sent and handled properly indeed).

Taking a look here: Strange behaviour of handleCommand function in my plugin - Development / Add-ons - openHAB Community seems that is a problem related to the debug with eclipse.

So, my idea is to setup a demo server and install my binding. So I run

mvn clean install

in my command prompt and it cannot resolve dependencies.

My pom.xml looks like:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns:xsi="" xmlns=""



    <!-- -->

  <name>openHAB Add-ons :: Bundles :: ThreadCoap Binding</name>

and the error from mvn is:

[ERROR] Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.4.3:verify (karaf-feature-verification) on project org.openhab.binding.threadcoap: Feature resolution failed for [openhab-binding-threadcoap/4.1.0.SNAPSHOT]
[ERROR] Message: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=openhab-binding-threadcoap; type=karaf.feature; version=4.1.0.SNAPSHOT; filter:="(&(osgi.identity=openhab-binding-threadcoap)(type=karaf.feature)(version>=4.1.0.SNAPSHOT))" [caused by: Unable to resolve openhab-binding-threadcoap/4.1.0.SNAPSHOT: missing requirement [openhab-binding-threadcoap/4.1.0.SNAPSHOT] osgi.identity; osgi.identity=org.openhab.binding.threadcoap; type=osgi.bundle; version="[,]"; resolution:=mandatory [caused by: Unable to resolve org.openhab.binding.threadcoap/ missing requirement [org.openhab.binding.threadcoap/] osgi.wiring.package; filter:="(&(osgi.wiring.package=org.eclipse.californium.core)(version>=2.7.0)(!(version>=3.0.0)))"]]

Edit: Sorry, mispressed submit too early :D.

Anyway, does anyone has any idea about the solution?

Try a higher level than 2.7? It looks like up to 3.9 is available.

Try adding openhab-transport-coap to your feature.xml file similar to how it’s done in the Shelly Binding:

No luck, thanks anyway for your suggestion!

Ok, that worked, I had to remove the dependency on the POM file and add the feature on the feature.xml file so I’m expecting that a runtime californium version will be used, but why?

Am I missing something?

Thanks for your support anyway!

1 Like

This goal checks that your Karaf feature can be installed. So it checks if all the required packages imported by the bundles installed by your Karaf feature can be resolved. So either all required packages should be exported by the bundles in your feature or provided by some other feature. openHAB already provides the openhab-transport-coap feature which provides the Californium packages. So if you add a feature dependency on openhab-transport-coap you make sure that this feature will also be installed whenever your add-on feature is installed.

Sorry for the late reply but many thanks to take time to explain me the matter!


1 Like