This reminds me of another bug I forgot to report. If <ant/> is called without setting target, the default target is called. If there is no default target, the "" target is called. This means that the top-level tasks are called twice.
Example: hello.xml <project> <echo>Hello world</echo> </project> build.xml ... <ant antfile="hello.xml"/> The solution is not to execute the target if the target is "". On Wednesday 10 September 2003 14:17, [EMAIL PROTECTED] wrote: > bodewig 2003/09/10 06:17:00 > > Modified: src/main/org/apache/tools/ant/taskdefs Ant.java > Log: > It is legal to omit the target attribute in <ant>, don't die with a NPE >
Index: src/main/org/apache/tools/ant/taskdefs/Ant.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Ant.java,v retrieving revision 1.88 diff -u -r1.88 Ant.java --- src/main/org/apache/tools/ant/taskdefs/Ant.java 10 Sep 2003 13:17:00 -0000 1.88 +++ src/main/org/apache/tools/ant/taskdefs/Ant.java 10 Sep 2003 13:30:09 -0000 @@ -62,6 +62,8 @@ import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; +import java.util.Set; +import java.util.HashSet; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildListener; import org.apache.tools.ant.DefaultLogger; @@ -409,9 +411,9 @@ addReferences(); if (target != null) { - newProject.executeTarget(target); - } else { - newProject.executeTarget(""); + if (!"".equals(target)) { + newProject.executeTarget(target); + } } } finally { // help the gc @@ -441,6 +443,16 @@ * @throws BuildException under unknown circumstances */ private void overrideProperties() throws BuildException { + // remove duplicate properties - last property wins + Set set = new HashSet(); + for (int i = properties.size() - 1; i >= 0; --i) { + Property p = (Property) properties.get(i); + if (set.contains(p.getName())) { + properties.remove(i); + } else { + set.add(p.getName()); + } + } Enumeration e = properties.elements(); while (e.hasMoreElements()) { Property p = (Property) e.nextElement();
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]