Search code examples
mavenmaven-javadoc-plugin

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

  • 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.