Aggregating JXR Reports for Multi-module Projects

The aggregate parameter of the JXR Plugin can be used to generate JXR files for multi-module projects. Using this parameter, you can opt to generate one compiled set of JXR files for the whole project (all modules) or generate one set of JXR files for each module.

For example, you have the following directory structure:

  1. Project
  2. |-- pom.xml
  3. |-- Module1
  4. | |-- src
  5. | | `-- main
  6. | | `-- java
  7. | | `-- com
  8. | | `-- module1
  9. | | `-- app
  10. | | `-- Module1App.java
  11. | `-- pom.xml
  12. |-- Module2
  13. | |-- src
  14. | | `-- main
  15. | | `-- java
  16. | | `-- com
  17. | | `-- module2
  18. | | `-- app
  19. | | `-- Module2App.java
  20. | `-- pom.xml
  21. `-- Module3
  22. |-- src
  23. | `-- main
  24. | `-- java
  25. | `-- com
  26. | `-- module3
  27. | `-- app
  28. | `-- Module3App.java
  29. `-- pom.xml

And you have the following configuration in your pom.xml:

  1. <project>
  2. ...
  3. <reporting>
  4. <plugins>
  5. <plugin>
  6. <groupId>org.apache.maven.plugins</groupId>
  7. <artifactId>maven-jxr-plugin</artifactId>
  8. <version>3.4.0</version>
  9. <reportSets>
  10. <reportSet>
  11. <id>aggregate</id>
  12. <reports>
  13. <report>aggregate</report>
  14. <report>test-aggregate</report>
  15. </reports>
  16. </reportSet>
  17. </reportSets>
  18. </plugin>
  19. </plugins>
  20. ...
  21. </reporting>
  22. ...
  23. </project>

When you execute mvn site from the parent directory, which is Project, a set of JXR files will be created in the target directory of Project where all of the JXR files of the project's submodules are included. Otherwise a set of JXR files for Module1 will be generated in the target directory of Module1, another set of JXR files for Module2 will be generated in the target directory of Module2, and so on.