You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2008/06/18 11:29:50 UTC

DO NOT REPLY [Bug 45226] New: subant overrides properties

https://issues.apache.org/bugzilla/show_bug.cgi?id=45226

           Summary: subant overrides properties
           Product: Ant
           Version: 1.7.0
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
        AssignedTo: notifications@ant.apache.org
        ReportedBy: remie@backbase.com


Consider the following scenario:

<subant ...>
  <property name="a" value="someValue" />
  <property file="my.properties" />
</subant>

with the my.properties file having the following values:

# My.Properties
a=differentValue
b=This is ${a}
# End

If you output the property ${b} in the script you run using subant, the output
will read: "this is differentValue".

I would expect the output to be "this is someValue" since property ${a} has
already been declared before the property file was included and should not be
overwritten by the declaration in the property file.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 45226] subant overrides properties

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45226


Stefan Bodewig <bo...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |notifications@ant.apache.org
         AssignedTo|notifications@ant.apache.org|bodewig@apache.org
           Severity|normal                      |enhancement
          Component|Core tasks                  |Documentation




--- Comment #1 from Stefan Bodewig <bo...@apache.org>  2008-08-29 08:26:32 PST ---
unfortunately your expectation collides with backwards compatibility.

For historical reasons the last <property> nested into <ant> wins if multiple
properties use the same name.  see the last hunk in
http://svn.eu.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Ant.java?r1=275211&r2=275212
where Peter explicitly mentions backwards compatibility (more details probably
are in the mailing list).

<subant> inherits this behavior which should be documented.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
You are the assignee for the bug.

DO NOT REPLY [Bug 45226] subant overrides properties

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45226


Stefan Bodewig <bo...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |1.8.0




--- Comment #4 from Stefan Bodewig <bo...@apache.org>  2008-12-03 06:22:34 PST ---
svn revision 722898 ( https://svn.apache.org/viewcvs.cgi?view=rev&rev=722898 ) contains antunit tests for this, in particular the
testFileSeesInternalProperty in
http://svn.apache.org/repos/asf/ant/core/trunk/src/tests/antunit/taskdefs/subant-test.xml
is your original test case - and it passes in trunk.

Looks as if the problem has been fixed somewhere on the way.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

DO NOT REPLY [Bug 45226] subant overrides properties

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45226





--- Comment #3 from Stefan Bodewig <bo...@apache.org>  2008-09-01 21:31:30 PST ---
documented in svn revision 691102.

While I agree that having an option to reverse the evaluation would be nice it
isn't as easy as it sounds.  Keeping the report open to revisit it later.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

DO NOT REPLY [Bug 45226] subant overrides properties

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45226





--- Comment #2 from Remie Bolte <re...@backbase.com>  2008-08-29 08:46:43 PST ---
Although documenting would already help significantly, might it be a valid
proposal to add a attribute to handle the property load order? The default of
this property could be set to the historical behavior, yet allow for a
different loading mechanism when desired.

Right now I personally have the option to declare the property before i call
the subant (using inheritAll=true), in which case the value will not be
overridden. However, I could see a world in which this is not an option.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.