简体   繁体   中英

How to invoke a maven profile multiple times with different system properties

I have around 15 maven profiles which are identical except that they have different systemPropertyVariables in their configuration. I would like to execute them all with a single command, and I know I can use this: Executing multiple maven profiles

Is it possible to do this without having to list all the profiles in the maven command, ie can I make a single profile within my POM file that, in turn, invokes multiple profiles? Alternatively if I could execute a single profile multiple times with different systemPropertyVariables, that would work too.

You can activate a profile depending on a property. This can be the same property for many profiles, so using something like -Dsomeprop=true on the command line can activate many profiles for you.

That said, having 15 profiles is quite unusual and you should analyse whether your construction is too complicated.

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