ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Zhou <>
Subject The task's owning project accidently changed
Date Fri, 20 Sep 2002 07:02:28 GMT

Try the following build files:

===== a.xml =======================
<project name="a" default="main">

    <target name="main">

        <script language="beanshell"><![CDATA[
            print("before:  myant.project=" +;

        <ant antfile="b.xml" inheritRefs="true"/>

        <script language="beanshell"><![CDATA[
            print("after:   myant.project=" +;

        <ant id="myant" antfile="c.xml"/>



===== b.xml =======================

<project name="b" default="main">
    <target name="main"/>

===== c.xml =======================

<project name="c" default="main">
    <target name="main"/>

===== RESULT OF [ant -f a.xml] =======================

Buildfile: a.xml

   [script] before:  myant.project=a
   [script] after:   myant.project=b


Noticed that the owning project of "myant" task accidently changed after
a calling of ant task with "inheritRefs" on.

Because method copyReference() of class
trying to clone the referenced object and set the new cloned object to
new Project.  but the "Ant" is not clonable, so set calling
Ant.setProject() causes the change of the original task.

This causes some problem to me.  Anyone can help?

Michael Zhou <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message