'maven-javadoc-plugin sourceFileExcludes not working
I'm not too sure what is the right way to use this tag, but I use it like this:
<sourceFileExcludes>
<exclude></exclude>
<exclude></exclude>
</sourceFileExcludes>
It doesn't work at all. It seems that there was a known bug in maven that this tag won't work as I found these threads: https://stackoverflow.com/a/26223872/3209177
But that was a while ago. I didn't find much useful information on maven website as well.
So how can we exclude certain source files / classes while we build javadoc using maven?
Solution 1:[1]
Finally figured it out.
First, there was an known bug as tracked in this page: https://issues.apache.org/jira/browse/MJAVADOC-365 And the patch went into the plugin 2.10.2. So after that version, the bug is fixed. However, I was using some earlier version.
Second, use this schema:
<sourceFileExcludes>
<sourceFileExclude></sourceFileExclude>
<sourceFileExclude></sourceFileExclude>
</sourceFileExcludes>
To exclude file.
Third, in the sourceFileExclude, I used someClass.java, this is probably not right. Instead, I used someClass.* and this works for me.
Solution 2:[2]
You can use this pattern. It excludes the files irregardless of their package structure. More information here
<sourceFileExcludes>
<exclude>**/AppTest.java</exclude>
<exclude>**/Tester.java</exclude>
</sourceFileExcludes>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | pythonician_plus_plus |
Solution 2 | Mehdi |