I have a profile in my pom.xml which should be always active unless it is explicitely deactivated (-P !firstProfile). I solved this by using the activeByDefault flag:
<
One trick is to avoid activeByDefault
, and instead activate the profile by the absence of a property, eg:
firstProfile
!skipFirstProfile
...
You should then be able to deactivate the profile with -DskipFirstProfile
or with -P !firstProfile
, but otherwise the profile will be active.
See: Maven: The Complete Reference, Profile Activation - Activation by the Absence of a Property