[SOLVED] New Binding dependency problems

I keep having Eclipse tell me my binding is missing dependencies, and I have no idea why. I’ve updated the PR and no one seems to have a strong answer, either.

I did just notice this when I rebuild the POM:

[WARNING] The POM for org.openhab.addons.bundles:org.openhab.binding.insteonplm:jar:2.5.0-SNAPSHOT is missing, no dependency information available

I tried using the skeleton to add a new binding, and get the same error.

Could this be related to other dependency problems? The pom is there, and looks sensible. I tried copying in and updating one that was working, and nothing changed.

Where do you see that error? When building with maven or in eclipse? Is your binding in the bundles/pom.xml?

1 Like

First: Hillbrand, please let me thank you for continuing to answer. You’ve answered several of my questions and given me things to look at and at least try. It hasn’t gotten me unstuck, but you are listening and helping and I appreciate that a lot, even as I’m frustrated by being unable to move ahead.

More technical information about my current issue:

I started having a dependency error. I thought I could fix this by installing Eclipse to a new folder, then copying in my current org.openhab.binding.insteonplm folder, adding it to bundles/pom.xml, and then using maven to rebuild the BOM, and using Maven or Eclipse to rebuild the project.

Problem: Parts of my project weren’t being updated, no matter what I did. Code was, but the sources won’t load in the debugger. I was debugging with log messages which is doable, but nowhere near as effective as the debugger. Changes to the XML files, such as Thing properties, never updated.

Also, mvn said that org.openhab.binding.insteonplm wasn’t in the reactor if I tried to build just it with -pl. If I looked at the full output, Insteon PLM was never listed as a project.

Apparently, just putting the files in place and updating bundles/pom.xml and rebuilding the BOM isn’t enough to add it to Maven as a project, but I don’t know what is.

I installed a new, clean Eclipse, and then used the create skeleton script to create a skeleton insteonplm binding. Rebuild the BOM, and rebuilt all. It built clean, and the Maven output showed InsteonPLM in the list. -pl allowed me to select just org.openhab.binding.insteonplm. Apparently the skeleton script knows to do something I don’t.

I then put my code back in place, and ran: mvn -DskipChecks -DskipTests -B -pl org.openhab.binding.insteonplm clean install

(The -B means “batch mode” and shuts off colorization of the log output so it can be captured and copy/pasted more clearly.)

It gave the dependency error.

Building the project in Eclipse, or trying to start the debugger via app.bndtools gives the same dependency error.

The error is:

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

I’m not entirely sure what the error is trying to say I’m missing, but I’ve been unable to get past this error when it happens. It apparently happens more than I thought it did, because my fix for it was incomplete.

I think the problem is the last one, a missing requirement for org.openhab.core.binding, but I’m not 100% sure. And I have no idea where to get it or why it’s missing.

Putting the project in the bundles pom.xml should be enough for maven. The bom is not related to building the project, but for debugging in eclipse. It’s what the pom.xml of the demo project uses to get all binding references.
Maybe you have a typo in either the bundles pom or your project pom.xml. Can you build with maven from within the directory of your binding project? Running maven from root with pl should prefix : to the project: -pl :org.openhab.binding.insteonplm. Also when switching between different checks better use -am with maven to make sure the bundles pom is always also updated in your local maven repository.
Without being able to get this to run all other problems are at least caused by this. Because it’s maven manages the dependencies any problems with maven will break any other step.

Ah! I see my error! I was confusing bundles/pom.xml and bom/openhab-addons/pom.xml. Adding the module to bundles/pom.xml makes it show up in maven as expected, and generates the dependency error every time!

If I’m reading the error right, the last part is the important bit:

missing requirement [org.openhab.binding.insteonplm/]
    osgi.wiring.package; filter:="(osgi.wiring.package=org.openhab.core.binding)"]]

Does that mean that org.openhab.binding.insteonplm is missing the org.openhab.core.binding package, which osgi.wiring.package is supposed to provide?

As far as I can see, I don’t use that directly, although I do import org.openhab.core.binding.BindingConfig; which might cause cause it.

The only other place I find org.openhab.core.binding is in MANIFEST.MF files in the target directory.

Am I reading the error right? Where is org.openhab.core.binding supposed to come from?

I’m not sure. It should be by having the correct parent in the binding pom and possible to have a correct feature.xml for the binding.

I think I found it. I’m not too surprised to discover it’s probably user error. @hillbrand, maybe you or someone else can confirm what I’m thinking.

The error is complaining that it can’t find org.openhab.core.binding, right?

I have a file that implements this:

import org.openhab.core.binding.BindingConfig;
public class InsteonPLMBindingConfig implements BindingConfig {

Does that BindingConfig, that import, and that entire structure exist for OH2?

Is this missing because it’s actually missing? Have I unknowingly pulled an OH1 interface into this new 2.x binding, and it’s telling me it isn’t there because it isn’t there in 2.x?

If that’s the case, what I now really don’t understand is how it ever worked, and I would swear it did.

That is a class from the openHAB 1 compatible layer and should not be part of an version 2 binding. I don’t know why it did work for you. Did you have any openhab1 binding in your debug? That might load the openHAB 1 compatible layer so the class would be available.

1 Like

I do not know for sure, and I have cleaned up a bunch of prior broken copies so I can’t go back and check to see.

I suspect that it was working fine till I imported those modules from the 1.x insteonplm binding, and then I got the first of the dependency errors.

Thinking it was a bndtools problem, I created a new tree and moved things to it, but missed the bundles/pom.xml, which got me a half-built version that Eclipse could see but wasn’t really being built. Things sort of worked, because dependencies weren’t being checked.

Then I’d do something that got it added to bundles.pom, and dependencies would be properly built, and I’d get an error again.

That repeated several times while I struggled.

I’ve removed the reference to BindingConfig, and it’s tripped over several more things that are also in the 1.x compatibility layer. I’m, for the moment, commenting them out so I can see what they were and get the build going. Once I can build and debug again, I’ll figure out where they need to move.

I think the HandleCommand and similar will need to become channels on Things, not direct item access, and that the config belongs on the Things instead of as flags on the Items.

But that can wait till I have it building again. I think I have a path forward for that, though!

I couldn’t have gotten there without your help. I really appreciate it!

I have now removed all the OH1.x objects from my binding and the build works properly, with no missing dependencies.

It was missing dependencies, and it told me that. I didn’t realize they were actually old 1.x items, and looked for the error in the build tools. I feel fairly foolish about that.

Hopefully I can move ahead and figure out how to convert these items to commands on things, so that items can trigger those commands. That’ll be next.


@Laufeyjarson I am having the same problem. How did tell what objects are OH1.

Once Hillbrand gave me the clue that might be happening, I found the name of the object that was causing the dependency problem, such as BindingConfig from the example above, and then I searched the openhab1-addons git tree for that name. (The first time I used Github to search; later I cloned the openhab1-addons repo so I could grep it all locally. Either works.)

If the definition of the class shows up in that search, I figured it was a 1.x definition. They’re usually in org.openhab.core1/src/main/java/org/openhab/… somewhere.

I literally commented them all out. It left big swaths of missing code in my binding, but they’re all things that have to change anyway. It let it build, and gave me a good way to find out what I needed to replace before I was done.

1 Like