在不相关的项目中共享Maven pom.xml的部分的最佳方法? [英] Best way to share portions of a Maven pom.xml across unrelated projects?

查看:72
本文介绍了在不相关的项目中共享Maven pom.xml的部分的最佳方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们公司针对Maven poms定义了许多最佳实践".例如,为资源处理指定utf-8,要对其进行过滤的文件夹,处理单元测试与集成测试以及编译器设置.

Our company has defined a number of "best practices" with regard to Maven poms. For example, specifying utf-8 for resource processing, which folders to do filtering on, handling unit tests vs integration tests, and compiler settings.

现在,这些最佳实践记录在我们公司的Wiki上,但是当最佳实践"列表发生更改时,这些更改很少会反映在项目poms中,直到出现问题为止.人的本性就是一切…….

Right now, these best practices are documented on our company wiki, but when the list of "best practices" changes, these changes are rarely reflected in the project poms, until there is a problem. Human nature being what it is and all....

我们是否可以通过Maven提供/实施这些设置和属性?几乎就像给每个项目一个父pom.xml,但是我不希望(也不能)让所有这些项目都引用同一个父pom.

Is there some way we can provide/enforce these settings and properties via Maven? It's almost like giving every project a parent pom.xml, but I don't want (and can't) have all these projects reference the same parent pom.

我们需要一种可以在开发人员的机器以及我们的Hudson CI服务器上运行的方法.

We need an approach that will work on developer's machines as well as our Hudson CI server.

推荐答案

唯一的maven解决方案是公共父级.也许如果您使用了释放的"父母,您可以做到吗?

The only maven solution is a common parent. Perhaps if you used a 'released' parent you could do it?

制作一个仅包含父pom的项目,然后运行发布插件,将其发布到内部存储库中.然后将该父级用作所有项目的父级,让他们从您的仓库中下载它,而不是通过相对路径名找到它?

Make a project containing only the parent pom, and run the release plugin, publishing it to your internal repository. Then use that parent as the parent of all your projects, having them download it from your repo instead of finding it by relative pathname?

这篇关于在不相关的项目中共享Maven pom.xml的部分的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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