是否可以分割Maven Pom文件? [英] Is it possible to split maven pom files?

查看:243
本文介绍了是否可以分割Maven Pom文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以包含几个较小的pom文件来创建父pom文件. (例如,我想将报告拆分,将部分构建为自己的pom并将其包含在父pom中)以有效地对其进行管理

解决方案

如果使用的是Maven 2,则可以简单地创建多个父级别.第一个pom.xml( pom1 )将定义基本属性(例如存储库).具有 pom1 作为<parent>的第二个pom.xml( pom2 )将定义报告信息.依此类推...最后,真实的" pom.xml将继承 pom2 并将定义其自己的属性.

您可以根据需要创建任意数量的父级(当然,如果您有5个父级,则将很难维护).

请注意,Maven 3讨论了引入 mixin概念,这将使您可以将pom.xml分为几个文件,但看起来像直到maven 4才出现

Is it possible to include several smaller pom files to create the parent pom file. (e.g. I would like to split the reporting, build sections into their own poms and include them in the parent pom) for managing them effectively

If you are using Maven 2, you can simply create several parent levels. The first pom.xml (pom1) will define the basic properties (such as repositories for example). The second pom.xml (pom2), which has pom1 as <parent>, will define the reporting information. And so on... Finally, the "real" pom.xml will inherit from the pom2 and will define its own properties.

You can create as many parent levels as you want (of course, it will be harder to maintain if you have 5 parent levels).

Note that Maven 3 talked about introducing the mixin concept, which will allow you to fragment your pom.xml into several files, but it looks like that is not happening now until maven 4

这篇关于是否可以分割Maven Pom文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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