Building Openhab with the latest version (4.1.x)

So I’ve tried this for way too long, and I have no idea why this isn’t working, and I saw someone in a different thread have the same issue and still no response. So I’m trying to use eclipse, on Slackware Linux,

I cannot follow the directions and get a successful openhab build for eclipse. I follow the directions and it just results in a failed build. I tried with OpenJDK 17 and ZULU 17, same results. I’m using the eclipse installer per the directions. I follow it, then it builds, and it fails with 1000+ errors, and throws a popup error with this message


Failed to execute mojo org.apache.maven.plugins:maven-jar-plugin:3.0.2:jar {execution: default-jar}

You have to use a classifier to attach supplemental artifacts to the project instead of replacing them.

Error executing jar goal: Failed to execute mojo org.apache.maven.plugins:maven-jar-plugin:3.0.2:jar {execution: default-jar}

Failed to execute mojo org.apache.maven.plugins:maven-jar-plugin:3.0.2:jar {execution: default-jar}

You have to use a classifier to attach supplemental artifacts to the project instead of replacing them.

Error executing jar goal: Failed to execute mojo org.apache.maven.plugins:maven-jar-plugin:3.0.2:jar {execution: default-jar}

Failed to execute mojo org.apache.maven.plugins:maven-jar-plugin:3.0.2:jar {execution: default-jar}

You have to use a classifier to attach supplemental artifacts to the project instead of replacing them.

Error executing jar goal: Failed to execute mojo org.apache.maven.plugins:maven-jar-plugin:3.0.2:jar {execution: default-jar}

Failed to execute mojo org.apache.maven.plugins:maven-jar-plugin:3.0.2:jar {execution: default-jar}

You have to use a classifier to attach supplemental artifacts to the project instead of replacing them.

Also the build errors look like the compiler can’t find the source for other modules, for example

AllConfig cannot be resolved to a type	PersistenceModelManager.java	/org.openhab.core.model.persistence/src/org/openhab/core/model/persistence/internal	line 147	Java Problem


|Description|Resource|Path|Location|Type|
|---|---|---|---|---|
|ChangedEventTrigger cannot be resolved to a type|DSLRuleProvider.java|/org.openhab.core.model.rule.runtime/src/org/openhab/core/model/rule/runtime/internal|line 351|Java Problem|

|Description|Resource|Path|Location|Type|
|---|---|---|---|---|
|Class<ItemsGenerator> cannot be resolved to a type|AbstractItemsRuntimeModule.java|/org.openhab.core.model.item/src-gen/org/openhab/core/model|line 191|Java Problem|

|Description|Resource|Path|Location|Type|
|---|---|---|---|---|
|Class<ItemsScopeProvider> cannot be resolved to a type|AbstractItemsRuntimeModule.java|/org.openhab.core.model.item/src-gen/org/openhab/core/model|line 146|Java Problem|

Is this a bug because nobody uses eclipse? The instructions say eclipse is the recommended IDE. What am I missing? It seems like that popup error is the big issue, when I google that I get stuff about my pom.xml being wrong, so is that a bug in openhab or is something else going on? Is there some specific version of eclipse I should be using? I tried the latest 3 versions of eclipse, all the same error. Also I deleted ~/.m2/repository/ and ~/.p2 before each eclipse install, didn’t change anything.

I don‘t use Eclipse, so I can‘t really help you with that. But can you try building on the command line (mvn clean install) to see if there is any non-IDE related problem? That works fine for me.

If you only work on add-ons you don’t need to clone or import openHAB Core projects. It will make working with Eclipse a lot more faster too.

As a workaround, if you do want to work on openHAB Core you can usually close these runtime/model projects unless you want to work on them.

IIRC you can also keep them open and properly fix the errors by installing the Eclipse Xtext plug-in on the Eclipse Marketplace:

image

2 Likes

Hrm, looks like it builds fine from the command line (though some tests fail, that’s easy enough to work around).

But how do I run it from the command line?

1 Like

Since I know other people have been having this problem, I found out the fix.

I’m trying to work with a specific addon, in this case org.openhab.binding.juicenet, so the working steps are as follows:

  1. Install eclipse from the installer, I used 2023-06, I think some others work, but this works for the current 4.1.x branch, don’t forget to point the JRE to Java17
  2. Select Openhab, select ONLY openhab development and openhab addons, selecting openhab core breaks the build, it’s 100% unusable
  3. Let it install, edit the demo app pom.xml to add the addon you are working on per the instructions.
  4. Disable automatic builds (eclipse building isn’t going to work, don’t let it mess with things)
  5. Open the demo app app.bndrun, add the addon you want and resolve
  6. Now, for whatever reasons, the addons show as an empty project (I’m not sure why).
  7. From a console, go to the openhab-addons directory that was just installed and run mvn -DskipTests clean install this will install the addons back into the maven repo that eclipse pulls from
  8. Edit the source for the addon as you see fit
  9. Rebuild the addon, from the console, for juicenet: mvn -DskipTests -pl :org.openhab.binding.juicenet -am install
  10. In eclipse, you can now push run in your app.bndrun and it will run the modified code

It used to import all the hundreds of add-on projects. That didn’t make devs happy either as importing would take very long and Eclipse also became slow especially on older hardware.

It’s an annoying bug, I had a look and proposed a fix for this with bnd#5773.
What also works is downgrading the maven-jar-plugin to 2.6 in the POM.

This resolved my problem

1 Like

The Eclipse Bndtools 7.0.0 plug-in with my fix got released.
So if you upgrade to it you no longer need to use the workaround of changing the maven-jar-plugin to 2.6.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.