[英]How are conflicting properties resolved if multiple profiles are activated
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? Maven配置文件没有提到这一点,它可能是构建过程设计不良的标志,但是如果多个配置文件处于活动状态并且它们都定义了相同的属性,是否有解决冲突属性的规则?
Im quite sure that local declaration (in the pom.xml
) would override the declaration in the settings.xml
, not so sure for colocal profiles 我非常确定本地声明(在pom.xml
)会覆盖settings.xml
的声明,对于colocal配置文件不太确定
-Pprofile1,profile2
)? 如果通过CLI手动激活( -Pprofile1,profile2
),那么重要的顺序是什么? Thank you 谢谢
There is no resolving conflicts happening - only overriding. 没有解决冲突发生 - 只有覆盖。 Afaik the order is settings, pom, and then command line. Afaik顺序是设置,pom,然后命令行。 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. 对于pom和设置文件中的多个配置文件,文件中的顺序也很重要,除此之外根据Maven版本的不同而不同。
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. 我强烈建议减少您对配置文件的使用,这样您就不必担心这些复杂性,并且肯定会安装帮助插件。
Also you can see the effective pom within Eclipse in the M2Eclipse plugin in the POM editor. 您还可以在POM编辑器中的M2Eclipse插件中看到Eclipse中的有效pom。 That should help you in the mean time. 那应该会帮助你。
And answer to your questions: 并回答你的问题:
Yes 是
Yes 是
Yes 是
All orders matter and can result in, lets just say "surprising" results sometimes. 所有订单都很重要并且可能导致,有时候只会说“令人惊讶”的结果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.