如果激活了多个配置文件,如何解决冲突的属性 [英] How are conflicting properties resolved if multiple profiles are activated
问题描述
Maven配置文件文档没有提及这一点,这可能表明糟糕的构建过程设计,但是如果有多个配置文件处于活动状态并且它们都定义了相同的属性,那么是否存在解决冲突属性的规则?
Maven profiles documentation does not mention this, and it is probably a sign of bad build process design, but are there rules for resolving conflicting properties if multiple profiles are active and they all define the same property?
我非常确定本地声明(在pom.xml
中)将覆盖settings.xml
中的声明,而不是对于共本地配置文件不确定
Im quite sure that local declaration (in the pom.xml
) would override the declaration in the settings.xml
, not so sure for colocal profiles
- 文件中的声明顺序重要吗?
- 是否有一个可能很重要的已定义激活顺序?
- 如果通过CLI(
-Pprofile1,profile2
)手动激活,订单是否重要?
- is the declaration order inside the file important?
- is there a defined activation order that may be important?
- is the order important, if activated manually over CLI (
-Pprofile1,profile2
)?
谢谢
推荐答案
没有解决冲突的发生-只是覆盖. Afaik的顺序是设置,pom,然后是命令行.对于pom和设置文件中的多个配置文件,文件中的顺序也很重要,除此之外,根据Maven版本的不同,它们也有所不同.
There is no resolving conflicts happening - only overriding. Afaik the order is settings, pom, and then command line. For multiple profiles in a pom and settings file the order in the file matters as well and beyond that things are different depending on Maven version.
我强烈建议您减少配置文件的使用,以免您不必担心这些复杂性,并且肯定会安装帮助插件.
I would strongly suggest to reduce your usage of profiles so that you do NOT have to worry about these complexities and certainly get the help plugin installed.
您还可以在POM编辑器中的M2Eclipse插件中看到Eclipse中的有效pom.同时,这应该对您有帮助.
Also you can see the effective pom within Eclipse in the M2Eclipse plugin in the POM editor. That should help you in the mean time.
回答您的问题:
是
是
是
所有订单都很重要,并可能导致结果,有时只需说出令人惊讶"的结果即可.
All orders matter and can result in, lets just say "surprising" results sometimes.
这篇关于如果激活了多个配置文件,如何解决冲突的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!