diff --git a/src/main/org/apache/tools/ant/Project.java b/src/main/org/apache/tools/ant/Project.java index 4077314f1..ef3422092 100644 --- a/src/main/org/apache/tools/ant/Project.java +++ b/src/main/org/apache/tools/ant/Project.java @@ -212,13 +212,7 @@ public class Project { throw new BuildException("Can't load default datatype list"); } - Properties systemP = System.getProperties(); - Enumeration e = systemP.keys(); - while (e.hasMoreElements()) { - Object name = e.nextElement(); - String value = systemP.get(name).toString(); - this.setProperty(name.toString(), value); - } + setSystemProperties(); } public void setSystemLoader(ClassLoader systemLoader) { @@ -383,6 +377,16 @@ public class Project { log("Detected OS: " + System.getProperty("os.name"), MSG_VERBOSE); } + public void setSystemProperties() { + Properties systemP = System.getProperties(); + Enumeration e = systemP.keys(); + while (e.hasMoreElements()) { + Object name = e.nextElement(); + String value = systemP.get(name).toString(); + this.setProperty(name.toString(), value); + } + } + public void addTaskDefinition(String taskName, Class taskClass) { String msg = " +User task: " + taskName + " " + taskClass.getName(); log(msg, MSG_DEBUG); diff --git a/src/main/org/apache/tools/ant/taskdefs/Ant.java b/src/main/org/apache/tools/ant/taskdefs/Ant.java index 321b283e8..1e66a484f 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Ant.java +++ b/src/main/org/apache/tools/ant/taskdefs/Ant.java @@ -166,6 +166,10 @@ public class Ant extends Task { } else { prop1 = project.getUserProperties(); + + // set Java built-in properties separately, + // b/c we won't inherit them. + project.setSystemProperties(); } e = prop1.keys();