You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Srinivasan Chikkala <Sr...@Sun.COM> on 2007/09/11 01:20:08 UTC

How can I configure ant run plugin to run ant script with javac ant task with fork=false?

Hi

I am trying to call javac ant task in an ant script from  ant run plugin 
and getting the following error when the "fork" attribute is false in 
the javac task in my ant script. The workaround is to set "fork" to 
true, but how can I configure the ant run plugin so that it works with 
the javac ant task in the ant script with "fork=false"


Error output
------------

[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [antrun:run {execution: my-compile}]
[INFO] Executing tasks

compile:
     [echo] env.JAVA_HOME d:/Java/jdk1.5.0_06
    [javac] Compiling 10 source files to 
D:\chikkala\dev\mvn-plugin\MyBC2\build\classes
[INFO] 
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] 
------------------------------------------------------------------------
[INFO] Error executing ant tasks

Embedded error: The following error occurred while executing this line:
D:\chikkala\dev\mvn-plugin\MyBC2\build.xml:97: 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

Here is my maven-antrun-plugin configuration
---------------------------------------------

            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>                   
                    <execution>
                        <id>my-compile-id</id>
                        <phase>compile</phase>
                        <goals><goal>run</goal></goals>
                        <configuration>
                            <tasks>     
                                <ant antfile="build.xml" 
inheritAll="false" target="compile" >
                                </ant>
                            </tasks>
                        </configuration>                       
                    </execution>                   
             </plugin>

Here is the ant script in the build.xml
--------------------------------------


<target name="compile" >
    <property environment="env" />
    <echo message="env.JAVA_HOME ${env.JAVA_HOME} " />
    <property name="javac.classpath" value="" />
    <property name="build.classes.dir" location="build/classes" />
    <property name="src.dir" location="src" />
    <mkdir dir="${build.classes.dir}"/>
    <javac fork="false" srcdir="${src.dir}" destdir="${build.classes.dir}"
    debug="flase" deprecation="false" source="1.5" target="1.5" 
includeantruntime="false">
        <classpath>
            <path path="${javac.classpath}"/>
        </classpath>
        <compilerarg line=""/>
    </javac>           
</target>


thanks,

-- 
Srinivasan Chikkala
Open ESB Community (http://open-esb.org)


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org