【问题标题】:Unable to locate the Javac Compiler in MAVEN EXPORT无法在 MAVEN EXPORT 中找到 Javac 编译器
【发布时间】:2014-04-11 18:30:26
【问题描述】:

我想用 maven 导出一个 Java 项目。但是我变成了这个错误:

    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project craftbukkit: Compilation failure
[ERROR] Unable to locate the Javac Compiler in:
[ERROR] C:\Program Files\Java\jre8\..\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] 
[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 主页设置到此目录:

C:\Program Files\Java\jdk1.8.0

我必须做什么,它才能起作用?

谢谢!

【问题讨论】:

标签: java maven


【解决方案1】:

你可以试试:

  1. 如果您在 Eclipse 中,则可以检查已安装的 JRE。
  2. 尝试更新版本的 maven-compiler-plugin 并设置您的源和目标版本。
  3. 回显 $JAVA_HOME 并确保它指向您提到的位置。
  4. 尝试 javac 一个 java 代码以更确定您的默认 java 编译器。
  5. 使用 mvn package assembly:single 进行导出。

【讨论】:

  • 感谢它现在有效!如何从 Github 项目的最新源更新 Maven 项目?
  • 也许我没有得到你想要的。但是对于任何其他项目,您可以通过 git 命令更新您的项目,并使用 maven 重新编译它。顺便问一下,您的问题是如何解决的?
猜你喜欢
  • 2012-12-19
  • 2012-10-21
  • 1970-01-01
  • 2012-09-17
  • 1970-01-01
  • 2014-09-20
  • 2011-06-06
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多