Maven项目是否可以从pom依赖项继承报表配置? [英] Is there a way for a Maven project to inherit report configurations from a pom dependency?

查看:136
本文介绍了Maven项目是否可以从pom依赖项继承报表配置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道可以在父POM中配置该部分并将其应用于多模块项目中的子模块.但是,我希望有一个单独的POM作为依赖项进行引用,因此我可以拥有可以混入"各种项目的报告配置,而不必在多个项目之间复制我的报告配置. (请参见此处的依赖项POM": http ://sonatype.com/books/maven-book/reference/pom-relationships-sect-pom-best-practice.html )

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)

例如,对于我的Widget项目,我有一个父POM(小部件-父级),它带有两个子模块,即widget-core和widget-web.我想有一个单独的POM,即静态分析,该控件是父部件依赖的.静态分析将具有一个块,该块将定义Checkstyle和FindBugs报告.构建小部件时,我希望Checkstyle和FindBugs可以在小部件核心和小部件网络上运行.

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.

如果您的解决方案仅在特定版本的Maven中有效,请告诉我.我们尚未升级到3.x.

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

推荐答案

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

这篇关于Maven项目是否可以从pom依赖项继承报表配置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆