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

Gun*_*nar 7 java pom.xml maven-3 maven maven-site-plugin

我想通过Maven的站点插件生成自定义报告,但只有这个自定义报告,而不是默认通过project-info-reports-plugin生成的所有报告.

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

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

A_D*_*teo 10

如评论中所述,但需要进一步说明(请参阅下面的第二种情况),您需要禁用/跳过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>
Run Code Online (Sandbox Code Playgroud)

请注意skip元素设置为true.这将跳过项目信息部分的生成(依赖关系,关于,摘要等).在报告部分中,您可以添加任何自定义报告(javadoc,checkstyle等),这些报告将添加到项目报告部分的顶部项目文档根目录下.

设置以下内容不会跳过它(只是尝试重新检查其行为):

<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>
Run Code Online (Sandbox Code Playgroud)

禁用默认" 项目信息"部分时的另一个注意事项:您将不再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>
Run Code Online (Sandbox Code Playgroud)

这仍将创建" 项目信息"部分,但仅提供"关于"页面,即您的项目的一般描述来自descriptionPOM 的元素.

在此输入图像描述