我有一个 ant 构建文件,它在自己调用时可以工作。当我从 Maven 调用它时,前几个任务执行良好(初始化、清理等),但构建失败并显示:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (compile) on project maven-stream: An Ant BuildException has occur
ed: The following error occurred while executing this line:
[ERROR] C:\maven_projects\cm\Qlarius Underwriter\build.xml:24: 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 "C:\Program Files\Java\jdk1.7.0_07\jre"
[ERROR] around Ant part ...<ant antfile="C:\maven_projects\cm/Qlarius Underwriter/build.xml">... @ 4:69 in C:\maven_projects\cm\target\antrun\build-ma
in.xml
为什么ant在直接调用而不是通过maven时会找到java?
pom.xml 文件的 ant 部分是:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<configuration>
<target>
<ant antfile="${basedir}/Qlarius Underwriter/build.xml">
<target name="LifeQuote"/>
</ant>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>