diff --git a/WHATSNEW b/WHATSNEW
index f1de02aa0..3af7e7797 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -281,6 +281,10 @@ Other changes:
This was confusing so the definitions are now treated as similar.
Bugzilla Report 31215.
+*
false
)<packageset>
elements.
A FileSet. All matched
files will be passed to javadoc as source files. Ant will
-automatically add the include pattern **/*.java
to these
-filesets.
**/*.java
(and
+**/package.html
if inncludenosourcepackages is true) to
+these filesets.
Nested filesets can be used to document sources that are in the default package or if you want to exclude certain files from diff --git a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java index ae13f67b3..856e809b0 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java +++ b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java @@ -434,6 +434,7 @@ public class Javadoc extends Task { private boolean linksource = false; private boolean breakiterator = false; private String noqualifier; + private boolean includeNoSourcePackages = false; private Vector fileSets = new Vector(); private Vector packageSets = new Vector(); @@ -1623,6 +1624,15 @@ public class Javadoc extends Task { this.noqualifier = noqualifier; } + /** + * If set to true, Ant will also accept packages that only hold + * package.html files but no Java sources. + * @since Ant 1.6.3 + */ + public void setIncludeNoSourcePackages(boolean b) { + this.includeNoSourcePackages = b; + } + /** * Execute the task. * @throws BuildException on error @@ -2080,6 +2090,9 @@ public class Javadoc extends Task { if (!fs.hasPatterns() && !fs.hasSelectors()) { fs = (FileSet) fs.clone(); fs.createInclude().setName("**/*.java"); + if (includeNoSourcePackages) { + fs.createInclude().setName("**/package.html"); + } } File baseDir = fs.getDir(getProject()); DirectoryScanner ds = fs.getDirectoryScanner(getProject()); @@ -2152,10 +2165,9 @@ public class Javadoc extends Task { File pd = new File(baseDir, dirs[i]); String[] files = pd.list(new FilenameFilter () { public boolean accept(File dir1, String name) { - if (name.endsWith(".java")) { - return true; - } - return false; // ignore dirs + return name.endsWith(".java") + || (includeNoSourcePackages + && name.equals("package.html")); } });