Although profiles cannot activate other profiles, there is still a workaround you may take.
When building, instead of activating Profile2 and Profile3 explicitly (by -P Profile2,Profile3
), activate them by using a variable, so that it looks like mvn compile -DactivateProfile2=true -DactivateProfile3=true
.
Then your requirement on Profile1 become straight forward: Profile1 (which includes Module1) is activated by activateProfile2=true, activateProfile3=true, !skipModule1