I have an old binding that I need to upgrade to 3.3.x. That binding uses some of the Apache Commons dependencies that have been removed in 3.3.x . So, I include the dependencies explicitly into Maven’s pom.xml with a compile scope, as if it where a regular external dependency that is not provided by a feature bundle by the Karaf runtime. Yet, the Karaf runtime complains it can not resolve that given package (“Unresolved requirement: Import-Package: org.apache.commons.io.output”). Why is that, since I do not declare it in feature.xml of that binding anyways ? it should be compiled into the binding’s .jar no?
Verify a target/features.xml file and if it includes the maven dependency as well. Depending on the dependency scope it might not be automatically included.
I think prior 3.1 commons was included by some core dependencies. It changed at some point of time (can’t remember when). If you compare contents of openhab-runtime-base feature all bindings depend you will find a reason for failure.
To make your feature resolve just add <bundle>mvn:commons-io/commons-io/xyz</bundle> in src/main/feature file. You can twist commons-io dependency scope to see which one causes automatic inclusion in there as I can’t find a clear reference in docs how it goes.
What I don’t understand that a maven dependency that is included with “compile” scope is not included in the final jar, and gets resolved by the karaf container instead. Like with any other “external” dependency I would imagine it gets packaged into the jar
Ok, so, even if you do not want karaf to provide a package/dependency, you still have to declare it explicitly in features.xml in order to have things resolve in the Karaf container.