Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

The following example shows how to generate two sets of Javadoc into different directories. The first set of code is in src/main/java/pkg1 and the second is in src/main/java/pkg2. Running "mvn site" creates the two sets of doc in target/site. This does not seem to be documented explicitly anywhere else.

There appears to be no way to explicitly specify the packages passed to the underlying javadoc tool, however, the subpackages can be specified. When specifying subpackages, all the packages under those named are included. Specific packages can be excluded from the report using <excludePackageNames> in the configuration.

By uncommenting the line with test-javadoc, the javadoc for the test source can generated similarly.

Note that the id element under reportSet is critical. Without it, only one set of documentation will be generated. The reporting plugin may be using the id as a key into a map or similar. 

No Format
    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <reportSets>
                    <reportSet>
                        <id>package-1</id>
                        <configuration>
                            <subpackages>pkg1</subpackages>
                            <name>Javadoc for Package 1</name>
                            <destDir>apidoc-package1</destDir>
                            <windowtitle>Package 1 API Documentation</windowtitle>
                        </configuration>
                        <reports>
                            <report>javadoc</report>
                        </reports>
                    </reportSet>
                    <reportSet>
                        <id>package-2</id>
                        <configuration>
                            <subpackages>pkg2</subpackages>
                            <name>Javadoc for Package 2</name>
                            <destDir>apidoc-package2</destDir>
                            <windowtitle>Package 2 API Documentation</windowtitle>
                        </configuration>
                        <reports>
                            <report>javadoc</report>
                            <!-- <report>test-javadoc</report> -->
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
        </plugins>
    </reporting>