微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

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

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

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

解决方法

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

但是,您需要从reports / 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等),这些报告将添加到项目报告部分的顶部项目文档根目录下.

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

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

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

原文地址:https://www.jb51.cc/java/120653.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐