Reputation: 97
I have an ant build file that works when invoked by itself. When I invoke it from maven, the first few tasks execute fine (init, clean, etc.), but build fails with:
[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
Why would ant find java when invoked directly but not through maven?
The ant portion of the pom.xml file is:
<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>
Upvotes: 3
Views: 9422
Reputation: 4675
As the error suggests you're not pointing to a JDK. You need to change JAVA_HOME to be the root of your JDK and not the JRE. That way it will be able to find javac
.
The other tasks init
and clean
will probably be ok if they are not using javac
Upvotes: 1