Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

maven

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?

like image 546
Nick Williams Avatar asked Jan 25 '13 08:01

Nick Williams


2 Answers

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

like image 55
Hardy Avatar answered Sep 28 '22 07:09

Hardy


And what about this?

<sourceFileExcludes>
    <exclude>net/my/packagename/mock/*.java</exclude>
    <exclude>net/my/packagename/samples/*.java</exclude>
    <exclude>**Mock*.java</exclude>
</sourceFileExcludes>
like image 21
ben75 Avatar answered Sep 28 '22 07:09

ben75