You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2004/01/14 16:43:23 UTC

DO NOT REPLY [Bug 26128] New: - Nested ant invocations can override properties

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26128>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26128

Nested ant invocations can override properties

           Summary: Nested ant invocations can override properties
           Product: Ant
           Version: 1.5.4
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: daveg@permabit.com


I have a chain of ant invocations in my project (cruisecontrol -> main build
file -> utility library), and I'm seeing property values change from one level
to the next.  A simple example follows:

---------------- 1.xml ----------------
<project name="1" basedir="." default="test">
  <target name="test" description="level 1">
    <ant antfile="2.xml" dir="." inheritall="true">
      <property name="test.property" value="1"/>
    </ant>
  </target>
</project>

---------------- 2.xml ----------------
<project name="2" basedir="." default="test">
  <target name="test" description="level 2">
    <echo message="level 2 test.property before = ${test.property}"/>
    <ant antfile="3.xml" dir="." inheritall="true">
      <property name="test.property" value="2"/>
    </ant>
  </target>
</project>

---------------- 3.xml ----------------
<project name="3" default="test" basedir=".">
  <target name="test" description="level 3">
    <echo message="level 3 test.property before = ${test.property}"/>
    <property name="test.property" value="3"/>
    <echo message="level 3 test.property after = ${test.property}"/>
  </target>
</project>

When I invoke:
ant -f 1.xml
I get: level 3 test.property before = 2

If in 2.xml the property statement is not embedded in the <ant> task,
everything works as expected, but I can't use this in my real project,
since I have multiple embedded invocations of the library task with different
property values.  If options are passed from the command line, everything
works as well.

Suggestions for work arounds are very welcome.  I can provide additional details
as needed.
Thanks,
Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org