diff --git a/src/main/org/apache/tools/ant/ProjectHelper.java b/src/main/org/apache/tools/ant/ProjectHelper.java index ca321a74c..be4dab23a 100644 --- a/src/main/org/apache/tools/ant/ProjectHelper.java +++ b/src/main/org/apache/tools/ant/ProjectHelper.java @@ -703,7 +703,7 @@ public class ProjectHelper { * * @param value the string to be scanned for property references. */ - public static String replaceProperties(Project project, String value, Hashtable keys ) + public static String replaceProperties(Project project, String value, Hashtable keys) throws BuildException { if (value == null) { return null; diff --git a/src/main/org/apache/tools/ant/Target.java b/src/main/org/apache/tools/ant/Target.java index 36a28ffd4..4fd72dc8d 100644 --- a/src/main/org/apache/tools/ant/Target.java +++ b/src/main/org/apache/tools/ant/Target.java @@ -196,12 +196,19 @@ public class Target implements TaskContainer { } private boolean testIfCondition() { - return "".equals(ifCondition) - || project.getProperty(ifCondition) != null; + if ("".equals(ifCondition)) { + return true; + } + + String test = ProjectHelper.replaceProperties(getProject(), ifCondition, getProject().getProperties()); + return project.getProperty(test) != null; } private boolean testUnlessCondition() { - return "".equals(unlessCondition) - || project.getProperty(unlessCondition) == null; + if ("".equals(unlessCondition)) { + return true; + } + String test = ProjectHelper.replaceProperties(getProject(), unlessCondition, getProject().getProperties()); + return project.getProperty(test) == null; } }