Reputation: 89993
I've got 3 modules:
and 3 profiles:
I'd like to build Module1
if:
Profile2
or Profile3
is activated, andskipModule1
is not set.Regardless of whether Module1
is built, Profile2
and Profile3
should build (both) modules Module2
and Module3
. Can this be implemented in Maven 3? If so, how?
The problem, as I see it, is that profiles can't activate other profiles
and I can't include Module1
as part of Profile2
or Profile3
because there is no way for me to specify that Module1
should be skipped if skipModule1
is not set.
Upvotes: 1
Views: 175
Reputation: 40036
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
Upvotes: 1