diff --git a/manual/properties.html b/manual/properties.html
index e42d3a2aa..cfb59ea8b 100644
--- a/manual/properties.html
+++ b/manual/properties.html
@@ -77,13 +77,18 @@ ant.project.invoked-targets
been specified on the command line (the IDE,
an <ant> task ...) when invoking the current
project.
- This property is set when the first target is executed.
- So you can't use it in the implicit target (directly
- under the <project> tag).
+ This property is set properly when the first target is executed.
+ If you use it in the implicit target (directly
+ under the <project> tag) the list will be
+ empty if no target has been specified while it
+ will contain the project's default target in this
+ case for tasks nested into targets..
ant.java.version the JVM version Ant detected; currently it can hold
- the values "1.7", "1.6", "1.5",
- "1.4", "1.3" and "1.2".
-ant.core.lib the absolute path of the ant.jar
file.
+ the values "1.9", "1.8",
+ "1.7", "1.6", "1.5",
+ "1.4", "1.3" and
+ "1.2". ant.core.lib the absolute path
+ of the ant.jar
file.
There is also another property, but this is set by the launcher
diff --git a/src/main/org/apache/tools/ant/Main.java b/src/main/org/apache/tools/ant/Main.java
index 85aaa28d7..edce9c1af 100644
--- a/src/main/org/apache/tools/ant/Main.java
+++ b/src/main/org/apache/tools/ant/Main.java
@@ -45,6 +45,7 @@ import org.apache.tools.ant.listener.SilentLogger;
import org.apache.tools.ant.property.GetProperty;
import org.apache.tools.ant.property.ResolvePropertyMap;
import org.apache.tools.ant.util.ClasspathUtils;
+import org.apache.tools.ant.util.CollectionUtils;
import org.apache.tools.ant.util.FileUtils;
import org.apache.tools.ant.util.ProxySetup;
@@ -917,6 +918,16 @@ public class Main implements AntMain {
buildFile.getAbsolutePath());
project.setUserProperty(MagicNames.ANT_FILE_TYPE,
MagicNames.ANT_FILE_TYPE_FILE);
+
+ // this list doesn't contain the build files default target,
+ // which may be added later unless targets have been specified
+ // on the command line. Therefore the property gets set again
+ // in Project#executeTargets when we can be sure the list is
+ // complete.
+ // Setting it here allows top-level tasks to access the
+ // property.
+ project.setUserProperty(MagicNames.PROJECT_INVOKED_TARGETS,
+ CollectionUtils.flattenToString(targets));
}
/**
diff --git a/src/tests/antunit/core/magic-names-test.xml b/src/tests/antunit/core/magic-names-test.xml
index 88d8b2ea2..f7a10ab9c 100644
--- a/src/tests/antunit/core/magic-names-test.xml
+++ b/src/tests/antunit/core/magic-names-test.xml
@@ -17,7 +17,9 @@
-->