One trick is to avoid activeByDefault
, and instead activate the profile by the absence of a property, eg:
<profiles>
<profile>
<id>firstProfile</id>
<activation>
<property>
<name>!skipFirstProfile</name>
</property>
</activation>
...
</profile>
</profiles>
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