通过mvn调用ant 的build.xml 文件
Mvn 命令出错,出错信息:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.013s
[INFO] Finished at: Wed May 02 13:36:28 CST 2012
[INFO] Final Memory: 3M/7M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.3:
run (compile) on project ep-cas-client: An Ant BuildException has occured: The f
ollowing error occurred while executing this line:
[ERROR] E:\casClient\build.xml:28: Unable to find a javac compiler;
[ERROR] com.sun.tools.javac.Main is not on the classpath.
[ERROR] Perhaps JAVA_HOME does not point to the JDK.
[ERROR] It is currently set to "D:\Java\jdk1.6.0_01\jre"
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
Xception
而直接 echo %Java_Home%
得到:
D:\Java\jdk1.6.0_01
再直接mvn –version:
Apache Maven 3.0.4 (r1232337; 2012-01-17 16:44:56+0800)
Maven home: D:\Java\apache-maven-3.0.4
Java version: 1.6.0_01, vendor: Sun Microsystems Inc.
Java home: D:\Java\jdk1.6.0_01\jre
Default locale: zh_CN, platform encoding: GBK
OS name: "windows vista", version: "6.1", arch: "x86", family: "windows"
发现 的确 mvn 指向的java home 是D:\Java\jdk1.6.0_01\jre
解决方法:
在build.xml 文件中添加
<property name="build.compiler" value="extJavac"/>