7

I'd like to generate a custom report through Maven's site plug-in, but only this custom report, not all the reports generated by default by means of the project-info-reports-plugin.

Question: What's the recommended way to achieve this?

I saw there are skip properties to disable specific reports contributed by that plug-in, but this seems tedious, so I am looking for a way to disable that plug-in altogether.

A_Di-Matteo
  • 23,746
  • 7
  • 79
  • 112
Gunnar
  • 15,675
  • 1
  • 44
  • 63
  • turn off project-info-reports-plugin ... – khmarbaise Mar 14 '16 at 08:43
  • 1
    But that's my question, how to do that? – Gunnar Mar 14 '16 at 08:51
  • 1
    Could this answer your question? [Disable a Maven plugin defined in a parent POM](https://stackoverflow.com/questions/7821152/disable-a-maven-plugin-defined-in-a-parent-pom) The `project-info-reports-plugin` plugin is defined in the global parent pom. – Ferrybig Mar 14 '16 at 09:41

1 Answers1

14

As mentioned in comments but requiring further clarification (see second case below), you need to disable/skip the plugin in your POM in order to disable the behavior you inherit from the default parent POM (via any existing chain of parent POMs).

However, you need to disable it from the reporting/plugins section (not the build/plugins section), as following:

<reporting>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-project-info-reports-plugin</artifactId>
            <version>2.9</version>
            <reportSets>
                <reportSet>
                    <configuration>
                        <skip>true</skip>
                    </configuration>
                </reportSet>
            </reportSets>
        </plugin>
        <!-- any further custom report here -->
    </plugins>
</reporting>

Note the skip element set to true. This will skip the generation of the Project Information section (Dependencies, About, Summary, etc.). In your reporting section you can then add any custom report (javadoc, checkstyle, etc.) which will be added to the Project Reports section, under the top Project Documentation root.

Setting the following would not skip it (just tried it to double check its behavior):

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-project-info-reports-plugin</artifactId>
            <version>2.9</version>
            <configuration>
                <skip>true</skip>
            </configuration>
        </plugin>
    </plugins>
</build>

One additional note when disabling the default Project Information section: you would not have an index.html file generated anymore (coming from the default About page), which may be annoying in general (we always want an index.html).

In such a case, a different solution would be to apply the following:

<reporting>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-project-info-reports-plugin</artifactId>
            <version>2.9</version>
            <reportSets>
                <reportSet>
                    <reports>
                        <report>index</report>
                    </reports>
                </reportSet>
            </reportSets>
        </plugin>
        <!-- any further custom report here -->
    </plugins>
</reporting>

Which will still create the Project Information section but only providing the About page, that is, a general description of your project coming from the description element of your POM.

enter image description here

A_Di-Matteo
  • 23,746
  • 7
  • 79
  • 112
  • 1
    Awesome answer; Good thinking with generating the "index" report, that's useful indeed. Many thanks! – Gunnar Mar 14 '16 at 11:07