具有自定义报告插件配置的 Maven 公共父级
我的团队有一个共同的父项目,其模块包含多个报告插件配置(例如 checkstyle 和 findbugs,类似于 Checkstyle 的多模块配置,但在单独的项目中)。我将把公共父项目称为“common”,将报告模块称为“build-tools”。
我试图找到一种方法,当公共项目发布时,让公共项目引用构建工具模块的正确版本,而无需手动发布。
以下是我尝试过的一些操作:
- 使用 ${project.version} 作为构建工具版本号。这使用在使用公共项目作为父项的项目中指定的版本号。
- 使用常规版本号。这些在公共项目中不会更新。
- 使用属性。同样,属性值在发布时不会更新。
谢谢!
My team has a common parent project with a module containing several reporting plugin configurations (e.g. checkstyle and findbugs, similar to Checkstyle's multimodule configuration, but in a separate project). I'm going to call the common parent project "common" and the reporting module "build-tools".
I'm trying to find a way to, when the common project is released, to have the common project reference the correct version of the build-tools module without doing a manual release.
Here are a couple of the things I've tried:
- Use ${project.version} for the build-tools version number. This uses the version number specified in the projects using the common as a parent.
- Use regular version numbers. These are not updated in the common project.
- Use a property. Again, the property value isn't updated on release.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您使用的是哪个版本的 maven-release-plugin?尝试 2.1。这应该正确处理版本属性的替换。
Which version of the maven-release-plugin are you using? Try 2.1. That should properly handle the replacement of version properties.
我知道做到这一点的唯一方法是使通用工具和构建工具具有相同的版本,并在发布时使用 -DautoVersionSubmodules:准备。由于通用聚合构建工具,如果在发布时两个模块具有相同的 SNAPSHOT 版本,则发布插件将发布并升级它们。
编辑:要保持依赖项版本正确,您的第一个选项应该有效。共同点:
这将使您的公共项目始终依赖于与公共本身版本相同的构建工具。如果它们总是同步上升,那就应该达到您的要求。是不是有什么问题呢?
The only way I know to do this is to make common and build-tools the same version and use -DautoVersionSubmodules when you release:prepare. Since common aggregates build-tools, if both modules have the same SNAPSHOT version when you do a release, the release plugin will release and uprev both of them.
Edit: To keep the dependency version correct, your first option should work. In common:
That will make your common project always have a dependency on build-tools with the same version as common itself. If they always uprev in lock-step, that should do what you want. Is there a problem with it?