ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <>
Subject RE: Un"bat"ing development: how to realize a forked ant
Date Thu, 27 Feb 2003 15:03:17 GMT
When forking your child Ant, you need to manually set the PATH and
CLASSPATH. Here's how I've done it to call back on the same build file,
after having changed the PATH and CLASSPATH. You probably need to call
another build file in your case. Hope that helps. --DD

PS: I agree with you that your extended <ant> task would be better.

    <property environment="env" />

    <path id="ant-CLASSPATH">
      <fileset dir="${ant.home}/lib" includes="*.jar" />
    <property name="ant-CLASSPATH" refid="ant-CLASSPATH" />

    <exec executable="${java.home}/../bin/java.exe"

      <arg value="-classpath" />
      <arg path="${ant-CLASSPATH}" />

      <arg value="" />

      <arg value="-logger" />
      <arg value="" />
      <arg value="-emacs" />
      <arg value="-buildfile" />
      <arg value="${ant.file}" />

      <env key="Path" path="${env.Path}" />

-----Original Message-----
From: Stefan Schulz [] 
Sent: Wednesday, February 26, 2003 10:23 AM
To: Ant Users List
Subject: Un"bat"ing development: how to realize a forked ant


the goal of my actions is to have a set of scripts, so I can develop and
deploy a java system with ant using windows as well as unix/linux.

By now, I have batch files to set several environment variables and
options for ant, jvm, and thirdparty java-tools. Of course, this is
awful to maintain, as the environment setting is at least duplicated
(.bat and .sh).

Unfortunately, in ant one cannot reset properties or environment
variables. Hence, I was going to use a "Meta"-build file, which sets the
needed variables 
and then calls the real build file by using the java-task with ant.
Doing so, the new ant task does not find javac anymore. JAVA_HOME is
incorrect, and setting JAVA_HOME with the java-task is ignored.

What I would actually need is something like this:
<ant fork="true" ...><env key="some" value="thing"/></ant>

Has anyone tried to do something similar or has anyone an idea, why my
approach fails?

Hope this is somewhat understandable :)

Thanks in advance

View raw message