Search code examples
mavenjavadoc

Maven: How do I exclude specific source files from javadoc?


I need to exclude specific source files (NOT just packages) from Javadoc using Maven. The <excludePackageNames> setting will not work for me: it only allows you to exclude certain packages. There's a <sourceFileExcludes> setting that has basically no documentation in the way of usage examples. It just says:

"sourceFileExcludes: exclude filters on the source files. These are ignored if you specify subpackages or subpackage excludes."

So, basically, I need to ignore all Java files that start with Mock, and also all Java files in two packages. Since sourceFileExcludes are ignored if I specify excludePackageNames, I can't combine them. So I tried this:

<sourceFileExcludes>
    <exclude>net/my/packagename/mock</exclude>
    <exclude>net/my/packagename/samples</exclude>
    <exclude>**/Mock*.java</exclude>
</sourceFileExcludes>

But it did not work. None of the intended files were excluded.

Anybody know how to use sourceFileExcludes?


Solution

  • It might just not be working at the moment. There is bug logged in the plugin issue tracker - MJAVADOC-365