我在Windows机器上构建Maven项目时遇到了一些麻烦。我已经设置了JAVA_HOME环境变量,Maven找到了它。
下面是一些执行的结果:
"mvn '
/cygdrive/c/Program Files/Apache/apache-maven-3.0.5/bin/mvn
"mvn - version"
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 05:51:28 0800)
Maven home: C:Program FilesApacheapache-maven-3.0.5
Java version: 1.6.0_45, vendor: Sun Microsystems Inc.
Java home: C:Program FilesJavajdk1.6.0_45jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 8", version: "6.2", arch: "amd64", family: "windows"
注意:它会在这里找到正确的JAVA_HOME路径!
build w/Maven:[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.
0.2:compile (default-compile) on project sportbukkit-api: Compilation failure
[ERROR] Unable to locate the Javac Compiler in:
[ERROR] C:Program FilesJavajre6..libtools.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.
可以看到,由于某种原因,它正在完全错误的目录中查找。请让我知道,如果需要更多的信息,或者如果你知道如何解决这个问题!谢谢你!
尝试将JAVA_HOME设置为C:Program FilesJavajdk1.6.0_45
而不是C:Program FilesJavajdk1.6.0_45jre