maven profile 优先级

maven profile是有优先级别

也就是说在setting.xml的profile优先级比pom中同名的profile高。

可以使用

mvn help:active-profiles  这个命令是检测当前有效的profiles列表

mvn -Pnpttest help:effective-pom  这个是检测当前有效的pom

结合之后,即可得到以下结果:

1、在settings.xml中的profile优先级高于pom中的

2、同在settings.xml的properties,profile在active-profiles 列表后面的,其properties为同名properties中最终有效。

3、如果有user setting和globel settings,则两者合并,其中重复的配置,以user settings为准。

原文地址:https://www.cnblogs.com/beiyeren/p/4316316.html