Reason: An Ant BuildException has occured: The following error occurred while executing this line:
C:\maventest\build.xml:79: 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 ..***\***\jre.
Cause: When Maven2 runs pom.xml it uses the jre (%JAVA_HOME%\jre) instead of %JAVA_HOME% and when ant build is using 'javac' task then maven2 tries to find javac in %JAVA_HOME%\jre.
Solution: Any of the following three can be used. Solution 1 is prefered.
1. Provide a property in pom.xml for maven-antrun-plugin to fork/use javac as an external process. Please see image for reference
Read more about the properties of this plugin at http://maven.apache.org/maven-1.x/plugins/java/properties.html
3. In ant build.xml at javac task use an attribue fork='true'