简体   繁体   中英

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?

Im quite sure that local declaration (in the pom.xml ) would override the declaration in the settings.xml , not so sure for colocal profiles

  • 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 )?

Thank you

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.

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.

And answer to your questions:

Yes

Yes

Yes

All orders matter and can result in, lets just say "surprising" results sometimes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM