当我尝试使用 Maven 编译项目时,出现以下错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project webserverlog: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project webserverlog: Compilation failure
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
我的 JAVA_HOME 指向 JDK:
$ echo $JAVA_HOME
/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
$ $JAVA_HOME/bin/javac -version
javac 1.7.0_25
javac: no source files
Usage: javac <options> <source files>
我不确定为什么 Maven 会在 JAVA_HOME 的末尾添加“/jre”,但是看看其他一些帖子,这似乎不是问题:
$ mvn --version
Apache Maven 3.0.4 (r1232337; 2012-01-17 18:44:56+1000)
Maven home: /Users/jerry/dev/springsource/apache-maven-3.0.4
Java version: 1.7.0_25, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.8.4", arch: "x86_64", family: "mac"
在过去的几天里,我一直在寻找解决此问题的方法并尝试了不同的方法,但找不到任何可行的方法。我见过一些有类似问题的线程,但没有一个建议对我有用。
有谁知道如何解决这个问题?非常感谢任何帮助...