I don't know if this is the official way to call ant within a java task, but
it works for me.  Maybe this can help you.  This will cause it to outlive
the starting script with no handle to it though.

<java classname="org.apache.tools.ant.launch.Launcher"
      dir="."
      fork="true"
      newenvironment="true"
      spawn="true"
      maxmemory="WHATEVER"
      taskname="WHATEVER">
        <classpath>
                <fileset dir="PATH_TO_ANT_LIBRARY" casesensitive="false">
                        <include name="*.jar" />
                        <include name="*.zip" />
                </fileset>
        </classpath>
        <arg value="-f" />
        <arg value="FILE_TO_RUN" />
        <arg value="-Dant.home=PATH_TO_ANT_HOME" />
        <arg value="TARGET_TO_RUN" />
</java>

Note, it is important to set the ant.home property for it to run correctly

Hope this helps!


-----Original Message-----
From: Dominique Devienne [mailto:[EMAIL PROTECTED] 
Sent: Monday, August 28, 2006 2:17 PM
To: Ant Users List
Subject: Re: Very Bad use of Ant...

You can always <java fork="true"> the other Ant, and since they live
in different processes and VMs, they can co-exist peacefully. I think
there's an example somewhere that demonstrates how to call Ant using
<java>. --DD

On 8/28/06, Dan McFadyen <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I am about to ask how to do something that will sound... very very ugly...
>
> Is there anyway to run a different version of Ant from within an Ant
script?
> I read the faq and found the explantation of the:
>
>     [exec] java.lang.NoClassDefFoundError:
> org/apache/tools/ant/launch/Launcher
>     [exec] Exception in thread "main"
>
> I have gone to the 2 different directories I need to run it, and I can run
> each fine (one defined in Env variables, other using absolute path to bin
> dir).
>
> But... is there any way to not get that?... Or am I stuck with a manual
step
> if I need 2 versions of Ant to play nice?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to