How to keep Maven profiles which are activeByDefault active even if another profile gets activated?
问题 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: <profiles> <profile> <id>firstProfile</id> <activation> <activeByDefault>true</activeByDefault> </activation> ... </profile> </profiles> Now in the same pom.xml I have a second profile defined this should only be active if the profile is really activated (-P secondProfile). So the default behaviour is: firstProfile active,