Failed to execute Goal org.apache.Maven.plugins:Maven-Compiler-plugin:2.5.1:Compile (default-Compile)

Asked

Viewed 4,911 times

4

By clicking on install in any of my three MVC parts, he makes reference to the cited error.

================================================================================
 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 doesn’t allow me to install it in order to run on Jetty/Apache. Does anyone know how to solve this?

  • As long as the environment is properly configured, JAVA_HOME, PATH and M2_HOME configured, test in CMD, with the -U option, to force download the updates.

1 answer

3


This is because to compile the code requires a JDK, not a JRE, which is what is being used for, or is in the PATH, or 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

The tools.jar exists only in the JDK, that a library not present in core java and containing utilities for JDK, including for the compilation. To solve this you must first install a JDK and then later set it up.

Case this using the Maven "inlaid", for example in eclipse, just go in Window --> Preferences --> Java --> Installed JREs and if there is no JDK added, just click on Add... and choose the directory of JDK. See image:

Adicionar JDK no Eclipse IDE

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

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

  • Thank you so much! It’s just that I had deleted the Metadata and so it was running on the JRE and not on the JDK. Done the proper add, now good wheel.

  • Tranquil @user25240. If you have been helpful, please consider accepting the answer :)

  • First post here, how do I accept your answer?

  • @user25240 take a look at tour, there explains straight ;)

  • 1

    Answer accepted!

  • Would you know to tell me if by now I’m making a mistake in the Times, you had something to do with this? Since it’s the same project I was working on before.

  • @user25240 Which Imports? If it is a dependency, see if the dependency is being solved correctly. If necessary include a new question.

Show 2 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.