Arend von Reinersdorff
Arend von Reinersdorff

Reputation: 4233

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.

Upvotes: 3

Views: 3264

Answers (3)

rmbrad
rmbrad

Reputation: 1082

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.

Upvotes: 3

question_maven_com
question_maven_com

Reputation: 2475

Use maven profile.

  1. add in your pom :

     <profiles>
         <profile>
         <id>javadoc</id>
         <modules>
             <module>module_include_javadoc1</module>
             <module>module_include_javadoc2</module>
         </modules>        
         </profile>
       </profiles>
    
  2. Run this:

     mvn javadoc:aggregate -Pjavadoc
    

Upvotes: 1

PaoloC
PaoloC

Reputation: 4105

Launch the following to generate javadocs only for foo-other-module1 and foo-other-module2 modules (note: always include the aggregator module, in this case foo-parent):

mvn javadoc:aggregate -pl :foo-parent,:foo-other-module1,:foo-other-module2

Since Maven 3.2.1, you can also exclude modules from your reactor, so the above simplifies to

mvn javadoc:aggregate -pl '!foo-module'

Upvotes: 6

Related Questions