[SOLVED] BUILD Failed Missing Dependencies

  • Platform information:
    • OS: Ubuntu 18.04.3 LTS
    • Java Runtime Environment: which java platform is used and what version
    • maven and java version: Apache Maven 3.6.0, Java version: 11.0.4
    • openHAB addons commit: 12b2190d1e31b67e8f23c03e8b9cecd0f571f326 (HEAD by now)
    • openHAB core commit: d23fb59ed7ae040ab0bfc9e9f9c096411e100fb7 (HEAD by now)
  • Issue of the topic: BUILD FAILURE
  • If logs where generated please post these here using code fences:

I want to develop bindings but i totally fail to build the addons or core repository because of missing dependencies. I’m starting from the scratch on my machine.

I call (in the addons root):
mvn clean install -U

I get the following error:

[ERROR] Failed to execute goal on project org.openhab.addons.bom.runtime-index: Could not resolve    dependencies for project org.openhab.addons.bom:org.openhab.addons.bom.runtime-index:jar:2.5.0-SNAPSHOT: The following artifacts could not be resolved: org.eclipse.orbit.bundles:com.google.gson:jar:2.8.2.v20180104-1110, de.maggu2810.p2redist:org.antlr.runtime:jar:3.2.0.v201101311130: Could not find artifact org.eclipse.orbit.bundles:com.google.gson:jar:2.8.2.v20180104-1110 in UK (http://uk.maven.org/maven2) -> [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 <goals> -rf :org.openhab.addons.bom.runtime-index

Before i tried this multiple times with my standard IntelliJ setup and maven. I read somewhere that the project is completely mavenized and therefore should build on other IDEs as well. Since I couldn’t resolve my issues i then installed the Eclipse IDE. After opening the IDE the build process started automatically and i ran into some “Out of Memory” issues. Don’t know what they belonged too.

I was able to compile e.g. /org.openhab.core.bom.openhab-core out of the ECLIPSE IDE via > run-as > Maven install but I can’t compile the whole project out of the ECLIPSE IDE because i cant access the pom file in the root. Don’t know why, its definetly in the folder.

I also tried to find this dependencies in the in the mvn repo:
https://mvnrepository.com/artifact/org.eclipse.orbit.bundles
–> nothing

Can someone help me please?

Did you follow the documentation to install eclipse:

Further more if you want to develop a binding do not have to build all and everything. It takes a long time to build all and it’s totally unneeded.

If you want to develop a new binding start here:

It also contains instructions on how to run maven effectively, only on your own binding.

You can probably still use IntelliJ. But you only need to import your own binding. I’m not familiar with debugging in IntelliJ, so that might be more of a challenge as it’s not documented for openHAB yet.

Unless something has changed in recent weeks, please use Java 8.

1 Like

Thx @marcel_erkel for your response.
I tried it with Java8 now, but thats not helping with the dependency issues.
Is it even related to each other?

Anyway, did anybody recently do a build from the scratch (e.g. removing the local .m2 folder and try to build it. Can anyone evaulate this please?

Did you customize your ~/.m2/settings.xml e.g. by adding a <mirror> to use that UK Maven repo for all downloads? That won’t work because not all our artifacts are in Maven Central. Maybe you can try using the default Maven settings?

It should be possible to build using Java 11 nowadays. I also use that on my desktop and we have Java 11 in our Travis CI build matrix to make sure it keeps working. The only remaining Java 11 build issues that I know of are some warnings. There could be others but certainly not these artifact download issues.

1 Like

Thx @hilbrand for the answer.

Yeah i did follow the documentation for installing eclipse. The only strange thing is that i get some out of memory exception when I install Eclipse. I guess its happening after the installation and during the attempt to build the project. I tried it twice and it reoccurs.

But Eclipse seems to work anyway. But i have this massive dependency issues.

Further more if you want to develop a binding do not have to build all and everything.

Understand that. But if I want to change an existing binding for example, than i should be able to build it right? I read somewhere that you should mvn clean install on the root folder and be able to build the whole project. I tried both: root directory or just building a particular binding. Both without success.

If i try to build a simple binding like the astro binding i get pretty much the same error like above.

Thx dude, that seem to solve at least a part of my problem.
I’m now able to build for example the astro binding or the solaredge binding, which i couldn’t before.

To explain the issue: yeah i had a customized settings.xml file for the artifactory of our company which seems to redirect to maven central as well. You said some of the dependencies are not reached with maven central.

How come if i delete my settings.xml and using the default one, that i find the dependencies now?
Where are they or which server should i add?

These repositories are defined in the POM files, e.g. in the infrastructure POM.

You can also exclude these repos from your mirror, see the Maven Mirrors Guide:

<mirror>
  <id>mycompanyrepo</id>
  <mirrorOf>*,!jcenter,!openhab-release,!openhab-snapshot,!bintray,!jfrog</mirrorOf>
  <url>https://mycompany.com/maven/</url>
</mirror>

You can also specify a settings file when excuting maven:

 -s,--settings <arg>                    Alternate path for the user
                                        settings file

I use some functions in my .bashrc file to detect based on Git and Maven info what settings file should be used:


function is-mycompany-project {
    if [ "$(git info 2>&1 | grep mycompany.com | wc -l)" -gt "0" ]; then
        true
    elif [ "$(cat pom.xml 2>&1 | grep com.mycompany | wc -l)" -gt "0" ]; then
        true
    else
        false
    fi
}

function maven-settings-file {
    if is-mycompany-project; then
        echo "-s $HOME/.m2/mycompany-settings.xml"
    else
        echo "-s $HOME/.m2/default-settings.xml"
    fi
}

function mci {
    mvn clean install $(maven-settings-file) $@
}

export -f is-mycompany-project
export -f maven-settings-file
export -f mci

FYI A build on the root should work. But it’s not needed to build or debug a single binding.