mavenmaven-javadoc-plugin

How to exclude a single module from Javadoc generation in a Maven multi module project?


I have a Maven multi module project like this:

foo-parent
    foo-module
    foo-module-new
    foo-other-module1
    foo-other-module2
    pom.xml

And when calling mvn javadoc:aggregate in foo-parent, I want to exclude the module foo-module from Javadoc generation.

Exclusion by package name with the parameter excludePackageNames doesn't work in my case because foo-module and foo-module-new have the same package name.


Solution

  • Since maven-javadoc-plugin:3.2.0 you can use the skippedModules property to provide a comma separated list of modules to skip. For instance the following configuration would skip the foo-module module:

    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-javadoc-plugin</artifactId>
      <reportSets>
        <reportSet>
          <id>aggregate</id>
          <configuration>
            <skippedModules>foo-module</skippedModules>
          </configuration>
        </reportSet>
      </reportSets>
    </plugin>
    

    Alternatively, you may use the maven.javadoc.skippedModules user property to achieve the same outcome.