我正在使用,maven第一次,它通过显示一些编译器错误

时间:2016-08-02 12:54:34

标签: maven

    [INFO] Scanning for projects...
    [INFO] Compiling 1 source file to D:\madhav\cluster_projects\firstmaven\target\classes
    [INFO] -------------------------------------------------------------
    [ERROR] COMPILATION ERROR : 
    [INFO] -------------------------------------------------------------
    [ERROR] Unable to locate the Javac Compiler in:
      C:\Program Files\Java\jre1.8.0_92\..\lib\tools.jar
    Please ensure you are using JDK 1.4 or above and
    not a JRE (the com.sun.tools.javac.Main class is required).
    In most cases you can change the location of your Java
    installation by setting the JAVA_HOME environment variable.
    [INFO] 1 error
    [INFO] -------------------------------------------------------------
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 1.314 s
    [INFO] Finished at: 2016-08-02T05:32:33-07:00
    [INFO] Final Memory: 7M/113M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project firstmaven: Compilation failure
    [ERROR] Unable to locate the Javac Compiler in:
    [ERROR] C:\Program Files\Java\jre1.8.0_92\..\lib\tools.jar
    [ERROR] Please ensure you are using JDK 1.4 or above and
    [ERROR] not a JRE (the com.sun.tools.javac.Main class is required).
    [ERROR] In most cases you can change the location of your Java
    [ERROR] installation by setting the JAVA_HOME environment variable.
    [ERROR] -> [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] `enter code here`
    [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

嗨,

我使用的是java 8,64位和apache maven3.3.9。  我在运行maven clean install时收到此错误消息,请帮我解决此问题。

1 个答案:

答案 0 :(得分:0)

您是否正确设置了java home?

请参阅此链接以了解如何设置https://confluence.atlassian.com/doc/setting-the-java_home-variable-in-windows-8895.html

你可以通过在控制台中键入java来检查是否设置了java home,如果设置正确,它将列出选项