Java – disable all reports in Maven’s project info reports plugin

I want to generate custom reports through Maven's site plug-in, but only this custom report, instead of all reports generated through the project info reports plugin by default

Question: what is the recommended method?

I see a skip attribute to disable specific reports provided by the plug-in, but it looks boring, so I'm looking for a way to disable the plug-in completely

Solution

As mentioned in the comment, but need further explanation (see the second case below), you need to disable / skip the plug-in in POM to disable the behavior inherited from the default parent POM (through any existing parent POM chain)

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

<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>

Notice that the skip element is set to true This will skip the generation of the project information section (dependencies, about, summary, etc.) In the report section, you can add any custom reports (Javadoc, checkstyle, etc.), which will be added to the root directory of the project document at the top of the project report section

Setting the following will not skip it (just try to recheck 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>

Another note when disabling the default project information section: you will no longer generate index HTML file (from the default about page), which is usually annoying (we always need index. HTML)

In this case, the different solution is 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>

This will still create the item information section, but only provide the about page, a general description of the item from the description element of the POM

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>