Openhab eclipse environment not responding to code changes

I wanted to create an openhab binding, so i followed the guide: installed the eclipse environment with the plugins, waited for it to build then used the “create_openhab_binding_skeleton.sh” to create a binding template. Maven compilation and eclipse autobuild functionality works at first, but after a while it stops seeing changes in my code (it runs the old code without new changes) and if i try to recompile it manually with

mvn clean install -DskipChecks -DskipTests

i get this error. And from then on mvn compilation does not work on that bundle, no matter what i do (delete m2. repository, readd the bundle to bom, bundle and feature files, play around with the app.bndrun etc.). If i try to delete the “target” folder of this binding in eclipse, it instantly recreates it with the old jar.

I have tried to reinstalled the environment with 2019-03, 2019-09 versions of eclipse, but i get the same problem.

From what i understand, is that some plugin for openhab get’s de-synchronized with the source code changes and fails to update itself, but i have no idea where this would happen, or how to update the project so that it would again see the code changes. Any ideas?

It’s always good to look what it is actually trying to tell you. It does in the error message:

Message: Unable to resolve root: missing requirement … Unable to resolve org.openhab.binding.taobaoairserial/2.5.0.201909100450: missing requirement [org.openhab.binding.taobaoairserial/2.5.0.201909100450] osgi.wiring.package; filter:="(osgi.wiring.package=org.eclipse.smarthome.io.transport.serial)"]]

While it is a bit verbose it tells what it’s missing. This means It’s missing the dependency on the serial feature. This is either something in the pom or feature.xml. Since it’s not a problem when compiling the source itself, but in the later steps. I’m certain this means you don’t have the dependency in the feature.xml and mis the following line : <feature>openhab-transport-serial</feature>.

When running the debug in Eclipse. Is also means you need to add the serial modules to your resolve list. Search in browser Repos for serial and drag all org.eclipse.smarthome.io.transport.serial to the Run requirements.

Hi,

I’m aware of what the error message says. So to go in more detail:

  1. I write the binding, it auto compiles
  2. I added serial listener part and it reads the serial port, i get the values.
  3. I can recompile the binding.
  4. … Som time later
  5. I’m continuing to make changes to the binding and when i launch it in eclipse, i see that it does not see the changes. It still runs, but does not see the changes that i made.
  6. I delete the maven repository - Still does not see the changes.
  7. In eclipse i do maven update on the whole project - Still does not see the changes.
  8. In eclipse i do Project - Clean (it has BuildAutomatically ticked), it cleans and rebuilds everything - Still does not see changes.
  9. I try to delete the target folder in eclipse, and it instantly creates another one - Still does not see changes.
  10. I delete the target folder in the file manager - Now cannot launch the binding, as there is no jar file.
  11. I try to manually run mvn clean install -DskipTests -DskipChecks in the binding folder - i get the mentioned compilation error.

I also tried to do as you suggested and add the <feature>openhab-transport-serial</feature> to the /openhab-addons/src/main/feature/feature.xml file like this:


     <feature name="openhab-binding-taobaoairserial" description="taobaoairserial Binding" version="${project.version}">
          <feature>openhab-runtime-base</feature>
          <feature>openhab-transport-serial</feature>
          <bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.taobaoairserial/${project.version}</bundle>
      </feature>

Still get the same compilation error, so i checked if the binding is registered in:

bom/openhab-addons/pom.xml
bundles/pom.xml

It is present both of those files. I also always add org.eclipse.smarthome.io.transport.serial to run requirements in app.bndrun and do Auto-resolve on save.

So from what i understand i should not be missing any depdendencies, but maybe i’m misunderstanding something?

Just to checking we’re talking about the same thing:

This looks like the feature file on the old location. With the current build system each binding has a feature file in binding directory. So you should have a feature file in /bundles/org.openhab.binding.taobaoairserial/src/main/feature/feature.xml

Can it be your source tree isn’t yet in sync with a recent version of the openHAB2-addons repository? And therefor still has the old feature file? If so how old is your source tree? It may help to rebase to the latest snapshot code (and don’t forget to use the force to your repo push -force-with-lease to github (but maybe you’re already know this :slightly_smiling_face:)

1 Like

Ah, ok, i was not aware (missed this somehow) that there is a features.xml file in the binding src folder. The last time i wrote something in openhab was a few months ago. Adding the depdency to this file seems to have solved the problem. Thanks for the suggestion!

I’m now wondering how the app was working in the first place (befor i added this part)?

I think those changes occurred between 2.5M1 and 2.5M2