javamavenmaven-3maven-site-plugin

How to generate one aggregate report in a multi-module project and non-aggregate reports for each child project with the MojoHaus Taglist Plugin?


I am unable to create one Apache Maven site containing multiple reports generated by the MojoHaus Taglist Plugin. It seems that one either has to decide on an aggregate report or on an non-aggregate report. But I would like to have both in the site output:

I have the following declared in my Aggregator POM pom.xml:

<build>
    <pluginManagement>
        <plugins>
            <configuration>
                <!--
                TODO(2023-06-16 by wolters): It does not seem possible to create aggregate reports for a parent
                but non-aggregate reports for a child with the MojoHaus Taglist Plugin..
                -->
                <aggregate>true</aggregate>
            </configuration>
        </plugins>
    </pluginManagement>
</build>

After running mvn site-deploy the created site contains an aggregated report for the multi-module project, but no report for the child project.

  1. Is it possible to achieve the creation of both reports with the MojoHaus Taglist Plugin?
  2. If it is possible: Can you provide a solution without using Maven profiles?

I tried different approaches, e.g. adding the plugin to the <builds><plugin> section and specifying an <execution>. But so far I wasn't able to achieve the desired result.

I am using the following:


Solution

  • Thanks to the user "luckyluke" that guided me into the right direction. Here is the anwer to my question.


    I was able to create both an aggregate report (in the Aggregator POM) and a non-aggregate report for each leaf/child POM with the "MojoHaus Taglist Maven Plugin".

    1. Configure the plugin in the <build>/<pluginManagement> section of the Parent POM pom.xml.

      <build>
          <pluginManagement>
              <plugins>
                  <plugin>
                      <groupId>org.codehaus.mojo</groupId>
                      <artifactId>taglist-maven-plugin</artifactId>
                      <version>3.0.0</version>
                      <configuration>
                          <emptyComments>true</emptyComments>
                          <linkXRef>true</linkXRef>
                          <multipleLineComments>true</multipleLineComments>
                          <showEmptyDetails>true</showEmptyDetails>
                          <skipTestSources>false</skipTestSources>
                          <tagListOptions>
                              <tagClasses>
                                  <tagClass>
                                      <displayName>To-do Tags</displayName>
                                      <tags>
                                          <tag>
                                              <matchString>TODO</matchString>
                                              <matchType>ignoreCase</matchType>
                                          </tag>
                                      </tags>
                                  </tagClass>
                                   </tagClasses>
                          </tagListOptions>
                      </configuration>
                  </plugin>
              </plugins>
          </pluginManagement>
      </build>
      
    2. Define the non-aggregate report in the <reporting> section of the Parent POM pom.xml.

      <reporting>
          <plugins>
              <plugin>
                  <groupId>org.codehaus.mojo</groupId>
                  <artifactId>taglist-maven-plugin</artifactId>
                  <version>${io.github.florianwolters.version.taglist-maven-plugin}</version>
                  <reportSets>
                      <reportSet>
                      <id>taglist-report</id>
                      <inherited>true</inherited>
                      <reports>
                          <report>taglist</report>
                      </reports>
                      <configuration>
                          <aggregate>false</aggregate>
                      </configuration>
                      </reportSet>
                  </reportSets>
              </plugin>
          </plugins>
      </reporting>
      
    3. Define the aggregate report in the <reporting> section of the Aggregator POM (that inherits the Parent POM) pom.xml.

      <reporting>
          <plugins>
              <plugin>
                  <groupId>org.codehaus.mojo</groupId>
                  <artifactId>taglist-maven-plugin</artifactId>
                  <reportSets>
                     <reportSet>
                          <id>aggregate-taglist-report</id>
                          <inherited>false</inherited>
                          <configuration>
                              <aggregate>true</aggregate>
                          </configuration>
                          <reports>
                              <report>taglist</report>
                          </reports>
                      </reportSet>
                  </reportSets>
              </plugin>
          </plugins>
      </reporting>