New Binding error - Cannot find directory for project: org.openhab.addons:org.openhab.addons.reactor

Hi there,

I did write a new binding to get soma data out of my sma inverter. Now I wanted to test everything and did a clean install via eclipse IDE. Unfortunately I am getting the following error:

[ERROR] Failed to execute goal org.commonjava.maven.plugins:directory-maven-plugin:0.3.1:directory-of (directories) on project org.openhab.binding.smainverter: Cannot find directory for project: org.openhab.addons:org.openhab.addons.reactor -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.commonjava.maven.plugins:directory-maven-plugin:0.3.1:directory-of (directories) on project org.openhab.binding.smainverter: Cannot find directory for project: org.openhab.addons:org.openhab.addons.reactor
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)

My pom is very simple:

<?xml version="1.0" encoding="UTF-8"?>
<parent>
    <groupId>org.openhab.addons.bundles</groupId>
    <artifactId>org.openhab.addons.reactor.bundles</artifactId>
    <version>2.5.0-SNAPSHOT</version>
</parent>


<groupId>org.openhab.binding</groupId>

<modelVersion>4.0.0</modelVersion>

<artifactId>org.openhab.binding.smainverter</artifactId>

I already did delete my maven repositories etc. as mentioned in one issue on github, but nothing helped me out - I would appreciate any suggestions…

Kind regards
Alex

Did you use the skeletonscript to generate the basis of you binding? If not can it be your binding is not in the bundle pom.xml?

no I did not use the skeleton script but copied an existing binding (mail) and changed everything like artifactId etc.
I used the IDE setup which is described here:


I thought that instead of using the astro binding as described in the example I could simply us my binding and run / test it…
AM I wrong with that?

No it’s not wrong. It’s just more work. You need to change the code on some other files too, while the skeleton script just generates that for you.

You should add your binding to the pom.xml in the bundle directory to get ride of this error. Or just use the skeleton script to create a new basis and just copy any code changes you made already into that new binding.

I ran in the same or similar problem. I tried to create a new binding with the skeleton script.

When trying to build the binding with the command mvn clean install -pl :org.openhab.binding.somfycul (from: https://www.openhab.org/v2.5/docs/developer/#develop-a-new-binding) I get the following error:

[INFO] Scanning for projects...
[INFO] 
[INFO] ------< org.openhab.addons.bundles:org.openhab.binding.somfycul >-------
[INFO] Building openHAB Add-ons :: Bundles :: SomfyCUL Binding 2.5.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ org.openhab.binding.somfycul ---
[INFO] 
[INFO] --- maven-enforcer-plugin:3.0.0-M2:enforce (enforce-java) @ org.openhab.binding.somfycul ---
[INFO] 
[INFO] --- directory-maven-plugin:0.3.1:directory-of (directories) @ org.openhab.binding.somfycul ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.497 s
[INFO] Finished at: 2019-12-17T09:38:25+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.commonjava.maven.plugins:directory-maven-plugin:0.3.1:directory-of (directories) on project org.openhab.binding.somfycul: Cannot find directory for project: org.openhab.addons:org.openhab.addons.reactor -> [Help 1]

My environment is

Apache Maven 3.6.3 (NON-CANONICAL_2019-11-27T20:26:29Z_root)
Maven home: /opt/maven
Java version: 1.8.0_232, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-8-openjdk/jre
Default locale: de_DE, platform encoding: UTF-8
OS name: "linux", version: "5.4.2-1-manjaro", arch: "amd64", family: "unix"

There is no IDE yet involved and I just followed the steps from the documentation linked above.

Not directly sure what causes it. But with the release of 2.5 there is technically no 2.5.0-SNAPSHOT anymore. So update the version in your pom to 3.0.0-SNAPSHOT and rebase your branch to openhab2-addons master and then run maven with additional commands: -am -U.

1 Like

Thanks :+1: Both suggestions (rebase and version change) did the trick!

The maven build works now!

@hilbrand It might be necessary to update the version in the skeleton build script. See https://github.com/openhab/openhab2-addons/blob/master/bundles/create_openhab_binding_skeleton.sh#L5

I assume that’s were the problem occured. There’s still 2.5.0-SNAPSHOT listed.

1 Like

@hilbrand I am just hitting the same trying to setup a 2.5.1 patch release build, see https://ci.openhab.org/view/Integration%20Builds%20(2.5.x)/job/openHAB2.5.x-Bundles/1/console. Any idea what I can do about it?

Has been fixed yesterday - thanks for the hint:

1 Like

Has this also been fixed for the 2.5.x branch?

Following PR #6702, I ended up performing git reset --hard against openhab:2.5.x, followed by ./create_openhab_binding_skeleton.sh.... for my custom binding to reimplement existing code into latest compile/runtime environment.

However, after doing so, my mvn clean install end up with the same error as described in this thread:

[ERROR] Failed to execute goal org.commonjava.maven.plugins:directory-maven-plugin:0.3.1:directory-of (directories) on project org.openhab.binding.freeathome: Cannot find directory for project: org.openhab.addons:org.openhab.addons.reactor -> [Help 1]

No, I am afraid it has not been ported for the new 2.5.x branch.

Hi, will it be? :slight_smile:

We are working on it.

Currently you have to perform two changes after running the script on the 2.5.x branch:

  1. Change the version in the POM of the new binding (pom.xml) to:
<version>2.5.1-SNAPSHOT</version>
  1. Change the openhab Core repository version in the feature file (src/main/feature/feature.xml) by renaming the variable {project.version} to {ohc.version}:
<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository>
3 Likes

@cweitkamp - works like a charm, thanks :+1:

Hey, I’m getting the same error in a PR for a new binding:

It’s already based on the 2.5.x branch, the version is already set to 2.5.1-SNAPSHOT and I also had made the change to {ohc.version} before.

Funny thing is, the travis check before my latest commit was successful.
The only thing I changed was to remove a newline in my local feature.xml which broke the generation of the global feature.xml.

Any ideas what I could do?

Hi, I ran into the same issue with PR #6785. So I checked the PR linked by @pravussum and noticed the issue was resolved there?

After comparing sources, I found out that in my PR the binding package was missing in bom\openhab-addons\pom.xml. After adding it, the Travis test completed succesfully. I had also previously changed the version to 2.5.2-SNAPSHOT and {ohc.version} in the feature file. Thought I’d share this for future reference.

Sorry, forgot to report back here. The version in the 2.5.x branch was changed from 2.5.1-SNAPSHOT to 2.5.2-SNAPSHOT while I created and tried to build the PR.
Once I updated everything from 2.5.x, (at least) this issue was fixed.