I have a profile activated by default in my maven setting file ~/.m2/settings.xml.
Is it possible to deactivate it from the command line by doing something like this:
mvn -P!profileActivatedByDefault
I have a profile activated by default in my maven setting file ~/.m2/settings.xml.
Is it possible to deactivate it from the command line by doing something like this:
mvn -P!profileActivatedByDefault
On a Mac, I got the following error attempting to use '!'
Doing the following works with the '-':
Alternatively you can do:
Maven Doc says -This option takes an argument that is a comma-delimited list of profile-ids to use. When this option is specified, no profiles other than those specified in the option argument will be activated.
That means the with these commands only those profile specified in the arguments will act as an active profile
Yes indeed, you have the right way. From maven profiles user guide
As noted by @Calfater in the comments, the exclamation mark needs to be escaped in most shells (bash, zsh, and others on Linux and MacOS), though not on the windows command line.
The escape mechanisms are shell-dependant, but usually you can do :
Or