diff --git a/WHATSNEW b/WHATSNEW
index 1c075d716..df4f23cec 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -107,6 +107,8 @@ Fixed bugs:
Other changes:
--------------
+ * -f/-file/-buildfile accepts a directory containing build.xml.
+
* The , and now support a new maxmemory
attribute.
Bugzilla Report 50513.
diff --git a/manual/running.html b/manual/running.html
index 35837e3df..ebe173212 100644
--- a/manual/running.html
+++ b/manual/running.html
@@ -37,7 +37,8 @@ attribute of the <project>
tag.
To make Ant use
a build file other than build.xml
, use the command-line
option -buildfile file
,
-where file is the name of the build file you want to use.
+where file is the name of the build file you want to use
+(or a directory containing a build.xml
file).
If you use the -find [file]
option,
Ant will search for a build file first in the current directory, then in
the parent directory, and so on, until either a build file is found or the root
diff --git a/src/main/org/apache/tools/ant/Main.java b/src/main/org/apache/tools/ant/Main.java
index c03e69526..63a3009dd 100644
--- a/src/main/org/apache/tools/ant/Main.java
+++ b/src/main/org/apache/tools/ant/Main.java
@@ -451,12 +451,14 @@ public class Main implements AntMain {
throw new BuildException("Build failed");
}
- // make sure it's not a directory (this falls into the ultra
- // paranoid lets check everything category
-
if (buildFile.isDirectory()) {
- System.out.println("What? Buildfile: " + buildFile + " is a dir!");
- throw new BuildException("Build failed");
+ File whatYouMeant = new File(buildFile, "build.xml");
+ if (whatYouMeant.isFile()) {
+ buildFile = whatYouMeant;
+ } else {
+ System.out.println("What? Buildfile: " + buildFile + " is a dir!");
+ throw new BuildException("Build failed");
+ }
}
// Normalize buildFile for re-import detection