Need some help with setup to create new binding using maven/bnd

I’ve done that, but that folder got created again when I called “mvn clean install -U”
This is its content:

again I got some warnings and errors at the end:

[WARNING] The POM for org.openhab.addons.bundles:org.openhab.binding.allplay-tchaikovsky.jar:jar:2.5.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.openhab.addons.bundles:org.openhab.binding.allplay-tchaikovsky-sources.jar:jar:2.5.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.openhab.addons.bundles:org.openhab.binding.leapmotion-LeapJava.jar:jar:2.5.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.openhab.addons.bundles:org.openhab.binding.plclogo-Moka7-1.0.2_io_patch.jar:jar:2.5.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.openhab.addons.bundles:org.openhab.binding.rfxcom-jd2xx.jar:jar:2.5.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.openhab.bundles:org.openhab.binding.synopanalyzer:jar:2.5.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.openhab.addons.bundles:org.openhab.binding.tellstick-netty-resolver-2.0.19.jar:jar:2.5.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.openhab.addons.bundles:org.openhab.binding.tellstick-javatellstick-1.1.jar:jar:2.5.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.openhab.addons.bundles:org.openhab.binding.tellstick-async-http-client-netty-utils-2.0.19.jar:jar:2.5.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.openhab.addons.bundles:org.openhab.binding.tellstick-netty-resolver-dns-2.0.19.jar:jar:2.5.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.openhab.addons.bundles:org.openhab.binding.tellstick-async-http-client-2.0.19.jar:jar:2.5.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.openhab.addons.bundles:org.openhab.binding.tellstick-netty-reactive-streams-1.0.8.jar:jar:2.5.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.openhab.addons.bundles:org.openhab.binding.tellstick-reactive-streams-1.0.0.jar:jar:2.5.0-SNAPSHOT is missing, no dependency information available

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for openHAB Demo 2.5.0-SNAPSHOT:
[INFO]
[INFO] openHAB Demo … SUCCESS [ 0.672 s]
[INFO] openHAB Demp :: App … FAILURE [02:27 min]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:28 min
[INFO] Finished at: 2019-04-03T15:12:50+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project org.openhab.demo.app: Could not resolve dependencies for project org.openhab.demo:org.openhab.demo.app:jar:2.5.0-SNAPSHOT: The following artifacts could not be resolved: org.openhab.addons.bundles:org.openhab.binding.allplay-tchaikovsky.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.allplay-tchaikovsky-sources.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.leapmotion-LeapJava.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.plclogo-Moka7-1.0.2_io_patch.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.rfxcom-jd2xx.jar:jar:2.5.0-SNAPSHOT, org.openhab.bundles:org.openhab.binding.synopanalyzer:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.tellstick-netty-resolver-2.0.19.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.tellstick-netty-all-4.0.42.Final.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.tellstick-javatellstick-1.1.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.tellstick-async-http-client-netty-utils-2.0.19.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.tellstick-netty-resolver-dns-2.0.19.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.tellstick-async-http-client-2.0.19.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.tellstick-netty-reactive-streams-1.0.8.jar:jar:2.5.0-SNAPSHOT, org.openhab.addons.bundles:org.openhab.binding.tellstick-reactive-streams-1.0.0.jar:jar:2.5.0-SNAPSHOT: Could not find artifact org.openhab.addons.bundles:org.openhab.binding.allplay-tchaikovsky.jar:jar:2.5.0-SNAPSHOT in openhab-artifactory-snapshot (https://openhab.jfrog.io/openhab/libs-snapshot) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :org.openhab.demo.app

There is a BOM that references that bundles.
The intention of the removal has been that the BOM is taken from the snapshot repository and no local build is used (so the most recent of https://openhab.jfrog.io/openhab/libs-snapshot/org/openhab/addons/bom/org.openhab.addons.bom.openhab-addons/2.5.0-SNAPSHOT/)
If the BOM is taken from the repository also the dependencies defined in the POM should be available in the repository.

The first missing one is

  • groupId: org.openhab.addons.bundles
  • artifactId: org.openhab.binding.allplay-tchaikovsky.jar

The dependency is declared here: https://openhab.jfrog.io/openhab/libs-snapshot/org/openhab/addons/bundles/org.openhab.binding.allplay/2.5.0-SNAPSHOT/org.openhab.binding.allplay-2.5.0-20190331.091233-6.pom

The files are not found in a Maven repository.

The JAR file itself are not found in a Maven repository.
They are pushed to the local repository while building the respective addon.

As already stated, this is a bad idea.
Your error is an example why we should not use such dependencies (it is similar as using the system scope).

is there a way I or someone can fix this? Maybe there is a workaround?
Should I clone addons and build those that are missing?

It should be fixed by the addons by moving to Maven coordinates for its dependencies.

What you can do as a workaround is to add an exclusions element for the addons bom dependency of the demo that contains an exclude section for every artifact that you listed above.

Unfortunately that will not happen for the mentioned ones. Most jars have been eliminated, but the listed ones are not going in the near future because lack of time :frowning:

A working demo repo for all the other working bundles would still be welcome.

Hm, shouldn’t this one https://github.com/openhab/openhab2-addons/pull/5385 already fix the dependency chain?

1 Like

this PR helped! Thank You very much :smiley:

When I launch localhost:8080 it asks for login/password. Is it correct behavior? IF Yes then what are the correct credentials?

Because the OSGi console is started as main web resource. (The oh dashboard does not exist in this setup and is actually deprecated anyway). You need to go to /paperui or /rest directly.

That makes sense :slight_smile:

For others having the same problem, You must navigate to /paperui/ (slash at end!)
If You don’t add that slash, You will get this as site content:

{{title}} chevron_right {{subtitle}}

1 Like

hi, I am trying to setup Eclipse + maven/bnd to debug the astro project from within Eclipse, as an example for binding dev.
I arrived at the point:

  • openhab2-addons and openhab-demo repos are updated from upstream
  • modified app.bndrun and pom.xml in project openhab-demo to include astro binding
  • compiled successfully with mvn clean install -U both the openhab-demo and the astro projects
  • I can start OH2 (Run OSGi) and PaperUI loads

unfortunately the astro binding does not show up under paperui/configuration/bindings page

What could I check to understand why astro binding is not loaded?

I am in the very same position.
I have add astro in pom.xml
Please try this:
In Tab app / Run, under Browse Repos, search for astro
Paste and copy org.openhab.binding.astro to Run Bundles
In Tab app / Source / look after -runbundles and Edit the line regarding astro as: org.openhab.binding.astro;version=’[2.5.0,2.5.1)’

In Tab app / Run should it be like: org.openhab.binding.astro;version=’[2.5.0,2.5.1)’

Run OSGi

//Basse

1 Like

Some more printouts:
g! smarthome:things list
astro:sun:local (Type=Thing, Status=ONLINE, Label=Astro sun data, Bridge=null)
g!

With the Channel, Position Elevation linked from PaperUI
g! smarthome:links list
Weather_Pressure -> yahooweather:weather:berlin:pressure
Weather_Humidity -> yahooweather:weather:berlin:humidity
MagicDimmer -> magic:dimmable-light:magicDimmer:brightness
Weather_Temperature -> yahooweather:weather:berlin:temperature
MagicOnOff -> magic:onoff-light:magicOnOff:switch
astro_sun_local_position_elevation -> astro:sun:local:position#elevation
MagicColor -> magic:color-light:magicColor:color
g!

//Basse

It worked for me!
Now the astro binding is activated!
Thanks!

I’ve successfully coded my new binding (PCF8574) but I’m unable to test it.
I’ve built my binding using mvn clean install -U


I’ve added binding to Run Requirements and Run Bundles:

but when I run or debug OSGi I get empty http://localhost:8080/paperui/#/configuration/bindings page:

Does anyone know what might be wrong?

Did you check the eclipse console for errors? Did you add the binding to the pom.xml?

Thanks for the tip, about pom.xml, that was the key
And a question regarding that, I can see that ex. astro is not in org.openhab.demp.app/pom.xml and works anyway, but I had to add my own binding there to have it working, hm?

Anyway this is how I have my binding running: ( I have used the script @hilbrand has designed to rebuild the binding for bnd)
In Eclipe / File / Import… / Maven / Existing Maven Projects / ‘Chose binding and Add it to Bundles’
Restart Eclipe( Maybe Refresh will do ?)
In Tab app / Run, under Browse Repos, search for ‘binding’
Paste and copy org.openhab.binding.‘binding’ to Run Bundles
In Tab app / Source / look after -runbundles and Edit the line regarding ‘binding’ as: org.openhab.binding.‘binding’;version=’[2.5.0,2.5.1)’

In Tab app / Run should it be like: org.openhab.binding.‘binding’;version=’[2.5.0,2.5.1)’

Run OSGi

BR Basse

1 Like

All bindings of openhab2-addons are automatically included, so they technically do not need to be in the pom.xml file. But if you read the “official” migration issue you see me adding astro anyway to get people used to the fact that you must add (your bindings) to the pom.xml file.

That is not required after the migration is done and some tweaks have been applied to openhab-core, but for now it is.

@David_Graeff I have added two dependencies to demo project:

<dependency>
     <groupId>org.openhab.addons.bundles</groupId>
     <artifactId>org.openhab.binding.pcf8574</artifactId>
     <version>${project.version}</version>
     <scope>provided</scope>
 </dependency>
 
     <dependency>
     <groupId>org.openhab.addons.bundles</groupId>
     <artifactId>org.openhab.binding.astro</artifactId>
     <version>${project.version}</version>
     <scope>provided</scope>
 </dependency>

Now after restarting Windows, I get these errors when trying to Run OSGi:

Status ERROR: bndtools.core code=0 Cannot find /error/org.openhab.binding.astro;version=[2.5.0,2.5.1) Not found in [bndtools.m2e.MavenImplicitProjectRepository@52314f7f, bnd-cache [C:/Users/Tomek/.bnd/default-ws/cnf/cache/4.2.0/bnd-cache r/w=false], org.openhab.demo.app [C:\openhab\openhab-demo\app\target\tmp\resolve\app\cnf\cache\4.2.0\org.openhab.demo.app r/w=false]] null

Status ERROR: bndtools.core code=0 Cannot find /error/org.openhab.binding.pcf8574;version=[2.5.0,2.5.1) Not found in [bndtools.m2e.MavenImplicitProjectRepository@52314f7f, bnd-cache [C:/Users/Tomek/.bnd/default-ws/cnf/cache/4.2.0/bnd-cache r/w=false], org.openhab.demo.app [C:\openhab\openhab-demo\app\target\tmp\resolve\app\cnf\cache\4.2.0\org.openhab.demo.app r/w=false]] null

Status ERROR: bndtools.core code=0 org.openhab.binding.astro;version=[2.5.0,2.5.1) Not found in [bndtools.m2e.MavenImplicitProjectRepository@52314f7f, bnd-cache [C:/Users/Tomek/.bnd/default-ws/cnf/cache/4.2.0/bnd-cache r/w=false], org.openhab.demo.app [C:\openhab\openhab-demo\app\target\tmp\resolve\app\cnf\cache\4.2.0\org.openhab.demo.app r/w=false]] null

Status ERROR: bndtools.core code=0 org.openhab.binding.pcf8574;version=[2.5.0,2.5.1) Not found in [bndtools.m2e.MavenImplicitProjectRepository@52314f7f, bnd-cache [C:/Users/Tomek/.bnd/default-ws/cnf/cache/4.2.0/bnd-cache r/w=false], org.openhab.demo.app [C:\openhab\openhab-demo\app\target\tmp\resolve\app\cnf\cache\4.2.0\org.openhab.demo.app r/w=false]] null

This is harder than I expected :sob:

I had similar issues today, closed the IDE and stopped openHAB development :smiley:
The current situation is a bit madness, I agree.

But there are only about 20 bindings left to port, before we can write a new binding development documentation and find out what’s the best way to do things. I assume the problem will go away if you “resolve bnd” once more from the UI. The problem -> That will “break” other stuff at the moment.

I watch this issue, the table is getting smaller and smaller :smile:
I’ll wait until the migration finish.
I wanted to finish by binding before the next milestone release because new bindings/updates require a new version of openHAB.

While reading issues I found Your PR. You are trying to split parts of the core into separate bundles.
I’ve started wondering: maybe add-ons/bindings could be separated from the main bundle?
Currently, when there is a bug in binding and it gets fixed we have two options:

  • manually install that binding
  • wait till next release of openHAB

Wouldn’t it be awesome if we could create, version and build each binding separately?
This would allow to quickly deploy fixes and new features.

Currently in Paper UI in bindings You see all bindings that are already there, all You must do is just enable them. Why not list bindings/add-ons/etc that are available to download?

Take a look at nuget, npm and others. Each binding is already built, it has dependencies listed, so it could be easily downloaded.
I know that bindings heavily relay on openHAB version, so each package should have minimum openHAB version requirement. This is how NuGet works - if You have a .NET 3.5 application You won’t see packages that require .NET 4.7.
Node-RED has this type of nodes management mechanism.

I know that this is getting a bit of the topic, but this is somehow related to creating and distributing new bindings.