1

Using Maven JavaDoc plugin, can I create Javadocs only for specific package? I have a parent module and want to generate Javadoc only for selected package in a child module. For example.

Parent
|
|__Module1
|____Package1
|____Package2
|
|__Module2
|____Package3
|____Package4

I want Javadocs only to work for Package2 under Module1

Saikat
  • 14,222
  • 20
  • 104
  • 125

1 Answers1

0

Define the javadoc plugin in the parent e.g.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <version>3.0.0-M1</version>
    <configuration>
        <skip>true</skip>
    </configuration>
</plugin>

So, javadoc generation is available but it is skipped by default.

In module1 declare the plugin with skip and sourceFileIncludes. For example:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <configuration>
        <skip>false</skip>
        <sourceFileIncludes>
            <exclude>Package2/*.java</exclude>
        </sourceFileIncludes>
    </configuration>
</plugin>

This enables javadoc generation for module1 but only targets classes in Package2.

This is verified with v3.0.0-M1 of the Maven Javadoc plugin.

glytching
  • 44,936
  • 9
  • 114
  • 120