Maven 项目有没有办法从 pom 依赖项继承报告配置?

发布于 2024-10-07 16:41:05 字数 623 浏览 2 评论 0原文

我知道可以在父 POM 中配置该部分并将其应用于多模块项目中的子模块。但是,我希望有一个单独的 POM 作为依赖项进行引用,这样我就可以拥有一个可以“混合”到各个项目的报告配置,而无需在多个项目中复制我的报告配置。 (参见“依赖 POM”:http ://sonatype.com/books/maven-book/reference/pom-relationships-sect-pom-best-practice.html

例如,对于我的Widget项目,我有一个父POM(widget-parent )有两个子模块,widget-core 和 widget-web。我想要一个单独的 POM,静态分析,widget-parent 所依赖的。静态分析将有一个块来定义 Checkstyle 和 FindBugs 报告。当我构建 Widget 时,我希望 Checkstyle 和 FindBugs 能够在 widget-core 和 widget-web 上运行。

如果您的解决方案仅适用于特定版本的 Maven,请告诉我。我们还没有升级到 3.x。

I know that it's possible to configure the section in a parent POM and have it apply to the sub-modules in a multi-module project. However, I'd like to have a separate POM to reference as a dependency so I can have a reporting configuration I can "mix in" to various projects without having to replicate my reporting configuration across multiple projects. (See "dependency POMs" here: http://sonatype.com/books/maven-book/reference/pom-relationships-sect-pom-best-practice.html)

For example, for my Widget project, I have a parent POM (widget-parent) with two sub-modules, widget-core and widget-web. I'd like to have a separate POM, static-analysis, that widget-parent depends on. static-analysis would have a block that would define Checkstyle and FindBugs reporting. When I build Widget, I would expect Checkstyle and FindBugs to be run on widget-core and widget-web.

If your solution only works in a particular version of Maven, let me know. We haven't upgraded to 3.x yet.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

浅唱ヾ落雨殇 2024-10-14 16:41:05

在 Maven 3 中,pom 中的报告元素消失了,取而代之的是站点插件的配置元素。然后,您可以使用常用的pluginManagement 来定义随处使用的配置。无论如何,我建议升级到 Maven 3,这给了你另一个很好的理由。

更新:报告元素已恢复,并可再次与最新版本的站点插件一起使用。

With Maven 3 the reporting element in the pom is gone and replaced by a configuration element for the site plugin. You can then use the usual pluginManagement to define a configuration that is used everywhere. I would suggest to upgrade to Maven 3 in general anyway and this gives you another good reason..

Update: The reporting element has been brought back and works again with latest versions of the site plugin.

凉城 2024-10-14 16:41:05

据推测,这从 2017 年春季发布的 Maven 3.5 开始就有效;请参阅相关问题

下的插件中定义的配置现在也将在 下使用。

如果您不知道如何进行插件管理,请参阅文档以获取更多信息在 Maven 中工作。

This supposedly works since Maven 3.5, which was released in spring of 2017; see the related issue.

Configuration defined in plugins under <build><pluginManagement> will be used under <reporting> too now.

Refer to the documentation for further info, if you don't know how plugin-management works in Maven.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文