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





------- Additional Comments From [EMAIL PROTECTED]  2004-01-14 16:37 -------
The doc is a little vague for "inherited" properties.
The easiest way to solve the problem is to
write a custom task to set userproperties:

    package task;
    import org.apache.tools.ant.taskdefs.Property;
    public class UserProperty extends Property {
       public UserProperty() {
          super(true); // set this as a user property
       }
       // Property#addProperty is incorrect for user properties
       public void addProperty(String n, String v) {
          if (getProject().getUserProperty(n) == null) {
             getProject().setUserProperty(n, v);
          } else {
             log("Override ignored for " + n, Project.MSG_VERBOSE);
          }
       }
    }

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

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

Reply via email to