Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin (default-compile) on project: Fatal error compiling: tools.jar not found

前端 未结 5 1533
时光说笑
时光说笑 2020-12-16 14:27

I have done all the steps provided in http://www.tutorialspoint.com/jsf/jsf_environment_setup.htm

Apache Maven and Apache tomcat both are ready. I also set the envir

相关标签:
5条回答
  • 2020-12-16 14:52

    You need to set eclipse's default installed "jre" to a jdk. Eclipse Window Menu => Preferences => enter search string "jre" in left navigation pane => click on "Installed JREs" in left navigation pane => Click Add and browse to your JDK. => click the check box next to the JDK to make it default.

    You may need to download and install the java jdk if you don't already have it.

    Also ensure the eclipse run configuration is set to use the default jdk you set up: Run Menu => Run Configurations => Select the run config for your project (Maven Build) => Click JRE tab => Under Runtime JRE select "workspace default".

    0 讨论(0)
  • 2020-12-16 14:52

    I delete my .m2 local local repository and re-run it. It works.

    0 讨论(0)
  • 2020-12-16 14:59

    Delete repository from .m2 -> repository and then right click on the project Run as... -> Maven install.

    After that, again right click on the project Maven -> Update project -> Check Update of Snapshots and click on the Ok option.

    0 讨论(0)
  • 2020-12-16 15:08

    I am using windows OS with JDK 1.9 in eclipse Oxygen. I faced this issue while compiling the project with JDK 1.9 while using maven and I solved by changing mvn.cmd file present in C:\apache-maven-3.5.2\bin.

    Before:

    set "JAVACMD=C:\Program Files\Java\jdk-9.0.1\bin\java.exe"
    

    After:

    set "JAVACMD=C:\Program Files\Java\jdk1.8.0_91\bin\java.exe"
    

    Also, make sure the compiler you use to build the project is correctly configured in IDE you use.

    0 讨论(0)
  • 2020-12-16 15:09

    Check the JAVA version, It should be same across all the places. See screenshots.

    1. pom.xml
    2. JAVA build path
    3. JAVA compiler

    Note: To see configuration window for 2 and 3... right click on the project and click properties

    0 讨论(0)
提交回复
热议问题