Failed to execute goal org.apache.maven.plugins: maven-compiler-plugin: 2.5.1: compile (default-compile)

4

When I click on the install in any of my three MVC parts, it references the error quoted.

================================================================================
 Scanning for projects...
[INFO] 
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Zeladoria Front-End 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ front-end ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ front-end ---
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 9 source files to C:\Users\eduardo\Desktop\categorias_novo\Versao 3.8 Rodrigo\zeladoria-all\front-end\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.875 s
[INFO] Finished at: 2015-05-19T09:38:18-03:00
[INFO] Final Memory: 6M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project front-end: Fatal error compiling: tools.jar not found: C:\Program Files\Java\jre1.8.0_31\..\lib\tools.jar -> [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/MojoExecutionException
================================================================================

In other words, it does not allow me to install to run Jetty / Apache. Does anyone know how to solve this?

    
asked by anonymous 19.05.2015 / 14:45

1 answer

3

This is because compiling the code requires a JDK , not a JRE , which is what you are using because it is either PATH , or it is the default set in your IDE

See this excerpt:

  

tools.jar not found: C: \ Program Files \ Java \ jre1.8.0_31 .. \ lib \ tools.jar

tools.jar only exists in JDK , than a library not present in core java and contains utilities for JDK , including for compilation. To solve this you must first install a JDK and then configure it.

If you are using maven " embedded ", for example in eclipse, just go to Window --> Preferences --> Java --> Installed JREs and if there is no JDK added, just click Add... and choose the directory of JDK . See image:

If you are using the command line, set JAVA_HOME to the JDK directory (something like C:\Program Files\Java\jdk1.8.0_31 installed.

At the command line you will also need to set the environment variable PATH , adding %JAVA_HOME%\bin to it

    
19.05.2015 / 14:59