禁用来自 Maven 的 project-info-reports-plugin 的所有报告

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

我想通过Maven的站点插件生成一个自定义报表,但是只有这个自定义报表,并不是所有的报表都是通过项目默认生成的-信息报告插件。

问题:推荐的方法是什么?

我看到有跳过属性来禁用该插件提供的特定报告,但这似乎很乏味,所以我正在寻找一种方法来完全禁用该插件。

如评论中所述但需要进一步说明(请参阅下面的第二种情况),您需要 disable/skip POM 中的插件以禁用从默认父 POM 继承的行为(通过任何现有的父 POM 链)。

但是,您需要从 reporting/plugins 部分(而不是 build/plugins 部分)禁用它,如下所示:

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

注意 skip 元素设置为 true。这将跳过 项目信息 部分(依赖项、关于、摘要等)的生成。然后,在您的报告部分,您可以添加任何自定义报告(javadoc、checkstyle 等),这些报告将被添加到 Project Reports 部分,在顶部 Project Documentation根.

设置以下不会跳过它(只是尝试仔细检查其行为):

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

禁用默认 项目信息 部分时的附加说明:您不会再生成 index.html 文件(来自默认的关于页面),这可能总的来说很烦人(我们总是想要一个 index.html)。

在这种情况下,另一种解决方案是应用以下内容:

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

仍然会创建 项目信息 部分,但只提供关于页面,即来自您的 description 元素的项目的一般描述POM.