| Forum | GitHub | Maps | Blog

Build system - Graphhopper-Core Jar issues / pom.xml Android


I’m working on a variation of PocketMaps but am having some issues now with modifying the underlying GraphHopper-core source base and importing it into this other project.
With the GH code from git, and using the android development folder, the build.gradle project file shows that it excludes certain packages.

    implementation(group: 'com.graphhopper', name: 'graphhopper-core', version: '0.11-SNAPSHOT') {
   exclude group: '', module: 'protobuf-java'
   exclude group: 'org.openstreetmap.osmosis', module: 'osmosis-osm-binary'
   exclude group: 'org.apache.xmlgraphics', module: 'xmlgraphics-commons'

I have since built the graphhopper-core JAR artifact from GH-core folder and then deployed it to a local Nexus maven repo manager. I then import this Jar into the other Android project (using the new repo in the project gradle file) but it shows an error of “unable to merge dex”.
The Sonatype repository AFAIK is where the regular snapshots and builds from GH upstream are built to. Using those 0.10-Snapshot and 0.11-Snapshot versions from Sonatype I don’t receive the same errors when importing GH-Core.
I would like to use a modified GH-Core Jar artifact to feed into the other Android Embedded project. Using a flat file tree with exclude dependencies is not allowed - based on info from here.

So the questions are as follows;

  1. A build system is building to Sonatype - is there a link to the build system and maintainers somewhere?
  2. When building the Jar artefact, are any changes made to the graphhopper-core folder from Git upstream before the build?
  3. When deploying the jar file and the pom file are any modifications made to the pom file / jar before they go on the repo?
  4. Has anyone had any success with deploying a local graphhopper-core artifact to Nexus or similar and then using it in an Android project?
  5. Is there an easier way to build the jar file such that the transient dependencies won’t cause the Dex merge issues - e.g. being able to avoid the exclude directives above?

Been struggling with this for a couple of days so appreciate any help on this. I realise that there are quite a few moving pieces in this puzzle and that this may not be the best location to ask the question. Will follow the moderators suggestions if the post is better placed in Stackoverflow or similar. Thanks


Can clone the repository and run a Maven install in local Maven repository (".m2" folder under profile dir).

Then can declare the local maven repository and use directly its artifacts in any projects.

That Android error message also appears with dependencies included multiple times coming from several sources.


Thanks for the quick reply. I’m not too familiar with Maven and hence am struggling with this.
I have the repository structure under /.m2 folder and got this through installing each of the -core -parent -api and -web-api artifacts using maven
mvn install:install-file -Dfile=../classes/artifacts/graphhopper_web_api_jar/graphhopper-web-api.jar -DpomFile=../web-api/pom.xml

Each of those Jar files have been generated using IntelliJ Artifact builder -> JAR -> creating module with dependencies
and modifying .m2/settings.xml to store to the local repository.
The issue is that building the Jars needs a Manifest.MF file that doesn’t seem to be present in the git repo.

At that point I can run ‘mvn package’ in graphhopper-core without an issue and that builds another graphhopper-core-snapshot.jar
Building jar: /core/target/graphhopper-core-0.11-SNAPSHOT.jar

The mvn install command leads to

/.m2/repository/com/graphhopper/graphhopper-core/0.11-SNAPSHOT/graphhopper-core-0.11-SNAPSHOT.jar being prepared.

In summary - I’m a little bit lost to how to follow the steps you have suggested.

Do you mean the sonatype repo? If so do you mean to scrape all the files in that repo - I’ve seen more info about local repo managers such as Nexus, Artefactory but very little about copying to the .m2 directory.
Maven install - running the ‘mvn install’ command?

Thanks and sorry for the somewhat basic questions. Just not seeing this for some reason.


Easier could be to open GraphHopper in IDE (e.g. IDEA) and run Maven “install” task from UI. (see image)

Then just need to add local Maven repository in project’s build.gradle:

repositories {


Thanks for this. Just as a reminder for myself and as a pointer for other people.
Using IntelliJ IDEA you can bring up the Maven Project elements highlighted above through, View -> Tool Windows -> Maven Projects.
When trying to build the project just through IntelliJ before I found that the SDK/JDK version that would work was 1.8 as there was a reference to something that would only work with that SDK. Building with 10 would allow the Maven build to work but with 1.8 there would be errors. I could get the Maven project install option working by first running the build (not via Maven) and then once that had compiled, the Maven install option would work.

Need to get the build running with 1.8 as otherwise with 10, the build would succeed but GraphHopper will not load fully and will fail when loaded from the other app. It would fail on either the set up of a new object - new GHRequest or the GHResponse that would then lead to an error stating that “Prepare finished but hopper not ready. This happens when there was an error while loading the files”.
With the 1.8 build, this does not happen.
Anyway thanks for the help so far!


For Android need to stay with Java 7 or 8 depending the minSdkVersion.
And so all libraries in dependencies should be built with such Java version.