2

Our repository has several projects which have very large pom.xml files with many dependencies and plugin configurations in each.

Does there exist any way of specifying our pom.xml outside of the standard xml on the Maven website?

The closest solution I know of is to abuse inheritance and separate dependencies and plugin configuration into parent projects, but this can only take us so far.

When the pom file splitting for Maven 3 is released it will relieve some of the pain, but my preferred solution would be a scripting language which could do the following:

  • specify dependencies as a single line instead of 5/6,
  • allow for simple reuse of plugin configurations between projects, and
  • be easily usable by new developers
4

2 回答 2

1

pom继承不是唯一的方法。您是否已经尝试使用像“材料清单”(BOM)这样的 POM 并且他们使用范围导入来导入它?

您可以在此页面Importing Dependencies的部分中找到有关此的更多信息。它将允许在项目之间简单地重用插件配置。

于 2012-07-09T22:26:48.920 回答
1

我发现简化 pom 文件的最简单方法之一是将编译阶段与部署阶段分开,而不是使用大量配置文件。

换句话说,您有一个项目可以以最简单的方式编译每个模块。使用默认名称生成 jar 或 war 文件!

然后,您为每个单独的“部署”(即部署到测试服务器)创建了一个项目,其中包含所有各种配置片段。然后“mvn clean package”重新部署。

于 2012-07-09T22:42:22.567 回答