How to build a specific binding with Maven

I’ve tried several times to get openHAB built with the Yoxos method, but failed over and over again (due to the famous Mwe2 stuff…).

  • Giving it up in the end, I moved to the Maven way of working (‘Pure Eclipse’ Instructions) and finally got openHAB built in the end.
    But it’s not clear to me what Eclipse is still doing in this setup, since it cannot be used to build openHAB from within Eclipse itself. Can someone explain?

  • Next to this, I would like to know if it’s possible to build only one binding (e.g. JointSpace) after having run once “mvn clean install”. I’m currently using “mvn -o install” after I modified a binding, but still, all the bindings are at least checked again, some of them build again.
    Is there an option one can give to Maven to only “recompile” that one binding?

If you cd bundles/binding/org.openhab.binding.<name> and type mvn -o clean install it ought to put the target files in the target subdirectory.

1 Like

Well, that’s simply perfect! Exactly what I was looking for. Nice thing is that you have the .jar file immediately available and don’t have to extract it from the addon zip file each and every time.
Very useful information, much appreciated!

1 Like

Hi there,
Is this valid for OH2 as well?

Hi,
for everyone like me getting back to this topic again and again, there is a better solution to this:
You should cd to the parent directory of your binding then execute:

mvn -pl org.openhab.binding.<name> -am clean install

This will build the given binding, download any requirements and also build any modules this modules is dependant on.

2 Likes

For the sake of correctness, the reference to the project should be (please note the colon in front of artifactId):

:org.openhab.binding.<name>

From maven manual:

A project can be specified by [groupId]:artifactId or by its relative path