GraphHopper.com | Forum | GitHub | Maps | Blog

Maven compiler error


#1

Hi all,

I’m totally new on graphhopper and i want to install it. I have follow different step on github guide but i have an error at the beginning of installation.
When i do :
./graphhopper.sh web europe.pbf
I have this output

## using java  (64bit) from /usr/lib/jvm/java-1.8.0-openjdk-amd64
./graphhopper.sh: ligne 86: mvn : commande introuvable
## using existing osm file europe.pbf
## building graphhopper jar: tools/target/graphhopper-tools-0.10-SNAPSHOT-jar-with-dependencies.jar
## using maven at ./maven
## compilation of parent failed
[INFO] Scanning for projects...
[WARNING] The project com.graphhopper:graphhopper-parent:pom:0.10-SNAPSHOT uses prerequisites which is only intended for maven-plugin projects but not for non maven-plugin projects. For such purposes you should use the maven-enforcer-plugin. See https://maven.apache.org/enforcer/enforcer-rules/requireMavenVersion.html
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] GraphHopper Parent Project
[INFO] GraphHopper Core
[INFO] GraphHopper Reader for OpenStreetMap Data
[INFO] GraphHopper Reader JSON
[INFO] GraphHopper Tools
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building GraphHopper Parent Project 0.10-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building GraphHopper Core 0.10-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ graphhopper-core ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] Copying 48 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ graphhopper-core ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 280 source files to /home/*****/graphhopper/core/target/classes
[WARNING] Unable to autodetect 'javac' path, using 'javac' from the environment.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] GraphHopper Parent Project ......................... SUCCESS [  0.114 s]
[INFO] GraphHopper Core ................................... FAILURE [  0.681 s]
[INFO] GraphHopper Reader for OpenStreetMap Data .......... SKIPPED
[INFO] GraphHopper Reader JSON ............................ SKIPPED
[INFO] GraphHopper Tools .................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.053 s
[INFO] Finished at: 2017-11-10T11:19:52+01:00
[INFO] Final Memory: 12M/422M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project graphhopper-core: Compilation failure -> [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/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :graphhopper-core

Is someone has same problem? I dont have any idea about the problem.

Thanks in advance for help,


#2

Could you try to run mvn clean compile -e in the graphhopper folder and report the results?

Cheers,
Robin


#3

Thanks for your answer.
I’ve done your manipulation below result :

root@srv-itineraire-01:/home/***/graphhopper/maven# mvn clean compile -e
Le programme « mvn » n'est pas encore installé. Vous pouvez l'installer en tapant :
apt install maven
root@srv-itineraire-01:/home/***/graphhopper/maven# cd ..
root@srv-itineraire-01:/home/***/graphhopper# apt install maven
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances
Lecture des informations d'état... Fait
Les paquets suivants ont été installés automatiquement et ne sont plus nécessaires :
  linux-headers-4.4.0-31 linux-headers-4.4.0-31-generic linux-image-4.4.0-31-generic linux-image-extra-4.4.0-31-generic
Veuillez utiliser « sudo apt autoremove » pour les supprimer.
Les NOUVEAUX paquets suivants seront installés :
  maven
0 mis à jour, 1 nouvellement installés, 0 à enlever et 3 non mis à jour.
Il est nécessaire de prendre 0 o/17,4 ko dans les archives.
Après cette opération, 122 ko d'espace disque supplémentaires seront utilisés.
Sélection du paquet maven précédemment désélectionné.
(Lecture de la base de données... 129229 fichiers et répertoires déjà installés.)
Préparation du dépaquetage de .../archives/maven_3.3.9-3_all.deb ...
Dépaquetage de maven (3.3.9-3) ...
Paramétrage de maven (3.3.9-3) ...
update-alternatives: utilisation de « /usr/share/maven/bin/mvn » pour fournir « /usr/bin/mvn » (mvn) en mode automatique
root@srv-itineraire-01:/home/***/graphhopper# mvn clean compile -e
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] GraphHopper Parent Project
[INFO] GraphHopper Core
[INFO] GraphHopper Reader for OpenStreetMap Data
[INFO] GraphHopper Reader for Gtfs Data
[INFO] GraphHopper Reader JSON
[INFO] GraphHopper Tools
[INFO] GraphHopper Directions API hand-crafted Java Client. For the Matrix and Routing API only
[INFO] GraphHopper Web
[INFO] GraphHopper Reader for Shapefile Data
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building GraphHopper Parent Project 0.10-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom (4 KB at 9.9 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-plugins/22/maven-plugins-22.pom
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-plugins/22/maven-plugins-22.pom (13 KB at 353.7 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.jar
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.jar (25 KB at 633.0 KB/sec)
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ graphhopper-parent ---
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0/plexus-utils-3.0.pom
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0/plexus-utils-3.0.pom (4 KB at 132.4 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/sonatype/spice/spice-parent/16/spice-parent-16.pom
Downloaded: https://repo.maven.apache.org/maven2/org/sonatype/spice/spice-parent/16/spice-parent-16.pom (9 KB at 272.1 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/sonatype/forge/forge-parent/5/forge-parent-5.pom
Downloaded: https://repo.maven.apache.org/maven2/org/sonatype/forge/forge-parent/5/forge-parent-5.pom (9 KB at 281.6 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0/plexus-utils-3.0.jar
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-utils/3.0/plexus-utils-3.0.jar (221 KB at 735.9 KB/sec)
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building GraphHopper Core 0.10-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ graphhopper-core ---
[INFO] Deleting /home/***/graphhopper/core/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ graphhopper-core ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] Copying 48 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ graphhopper-core ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 280 source files to /home/***/graphhopper/core/target/classes
[WARNING] Unable to autodetect 'javac' path, using 'javac' from the environment.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] GraphHopper Parent Project ......................... SUCCESS [  1.280 s]
[INFO] GraphHopper Core ................................... FAILURE [  0.659 s]
[INFO] GraphHopper Reader for OpenStreetMap Data .......... SKIPPED
[INFO] GraphHopper Reader for Gtfs Data ................... SKIPPED
[INFO] GraphHopper Reader JSON ............................ SKIPPED
[INFO] GraphHopper Tools .................................. SKIPPED
[INFO] GraphHopper Directions API hand-crafted Java Client. For the Matrix and Routing API only SKIPPED
[INFO] GraphHopper Web .................................... SKIPPED
[INFO] GraphHopper Reader for Shapefile Data .............. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.139 s
[INFO] Finished at: 2017-11-13T09:18:47+01:00
[INFO] Final Memory: 18M/425M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project graphhopper-core: Compilation failure -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project graphhopper-core: Compilation failure
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
        at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:976)
        at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
        ... 20 more
[ERROR]
[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/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :graphhopper-core

Is it possible my JAVA_HOME is set on the wrong directory :
JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk-amd64" ?


#4

If this path is your actual JAVA_HOME, then it should be correct. It is also a good idea to set the java home into your bin path. So if you run java -version and javac -version you should see the correct versions?

You could also try this.


#5

Thanks a lot for your answer.
Java was set but javac didn’t. It solved my problem. Sorry for that newbie mistake.

Guillaume