Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable all reports from Maven's project-info-reports-plugin

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.

like image 330
Gunnar Avatar asked Mar 14 '16 08:03

Gunnar


1 Answers

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

like image 145
A_Di-Matteo Avatar answered Nov 04 '22 10:11

A_Di-Matteo