Maven Ant BuildException with maven-antrun-plugin ... unable to find javac compiler

Posted by robsbobs on Stack Overflow See other posts from Stack Overflow or by robsbobs
Published on 2011-01-10T08:51:16Z Indexed on 2011/01/10 8:53 UTC
Read the original article Hit count: 246

Filed under:
|
|

Im trying to make Maven call an ANT build for some legacy code. the ant build builds correctly through ant however when i call it using the maven ant plugin it fails with the following error:

[

ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.6:run      (default) on project CoreServices: An Ant BuildException has occured: The following error occurred while executing this line:
[ERROR] C:\dev\projects\build\build.xml:158: The following error occurred while executing this line:
[ERROR] C:\dev\projects\build\build.xml:62: The following error occurred while executing this line:
[ERROR] C:\dev\projects\build\build.xml:33: The following error occurred while executing this line:
[ERROR] C:\dev\projects\ods\build.xml:41: 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:\bea\jdk150_11\jre"

My javac exists at C:\bea\jdk150_11\bin and this works for all other things. Im not sure where Maven is getting this version of JAVA_HOME. JAVA_HOME in windows envionrmental variables is set to C:\bea\jdk150_11\ as it should be.

The Maven code that im using to call the build.xml is

<build>
   <plugins>
    <plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-antrun-plugin</artifactId>
     <version>1.6</version>

     <executions>
          <execution>
            <phase>install</phase>
            <configuration>

              <target>
    <ant antfile="../build/build.xml" target="deliver" >



    </ant>


              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
    </plugin>
   </plugins>
  </build>

© Stack Overflow or respective owner

Related posts about java

Related posts about maven