I'm retrofitting bunch of existing Java projects with unified Maven build. Since each project is mature and has established Ant based build all I'm using maven-antrun-plugin to execute existing build.xml as follows:
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<configuration>
<tasks>
<ant antfile="build.xml" target="compile" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
When I run mvn compile build fails with this message:
[INFO] An Ant BuildException has occured: The following error occurred
while executing this line:
build.xml:175: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "C:\Java\jdk1.6.0_13\jre"
What puzzles me is
- I have
JAVA_HOME=C:\Java\jdk1.6.0_13as part of my environment setup and whenmvn.batis executed that is exactly value I'm getting, however as you see in the error message it comes up asC:\Java\jdk1.6.0_13\jre - If I run
ant compileeverything compiles just fine
Does it mean that perhaps maven-antrun-plugin does something like set JAVA_HOME=%JAVA_HOME%\jre? I searched my batch/build files I can't find where that change occurs