[SOLVED] An error occurred when I tried to include external packages to my current binding

Hi all, now I am using Eclipse to build my test binding. I want to ask what is the procedure to include an external package

ProvToolbox

which is loacted in the maven central? I only add the necessary maven dependencies into my pom.xml, which is shown in https://lucmoreau.wordpress.com/2014/08/01/provtoolbox-tutorial-1-creating-and-saving-a-prov-document/. And now my pom.xml is shown like this:


However, an error occurred in karaf-verify goal. A detailed error message is shown as below.

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

What makes things strange is that, as long as I add the external maven dependencies into the pom.xml, the error will happen. As long as I comment those external dependencies, the error disappeared. And I can’t figure out what is related with

org.apache.commons.cli

Can someone give me some hints, such that I can include the ProvToolbox successfully? Thanks!

I solved my issue my reading https://www.openhab.org/docs/developer/buildsystem.html carefully, and add those dependencies to feature.xml. However, I don’t understand why the error is about org.apache.commons.cli. Could anyone give me some hints?

What you are getting in now is making prov toolbox running under OSGi. My suggestion would be to check if someone ever did that.

My rough guess is that nobody ever even attempted that and you will stuck with long and painful OSGification process. What blows whole thing up currently is prov-toolbox and its dependency on commons-cli. Quickest workaround which I can suggest is just copying the class you need to binding for time being.

Please be aware that next in the queue is JAXB.

Best luck,
Łukasz

Thanks!! I am still reading your previous answers and learning. I improved a lot from your advice. :slight_smile: