I have a parent/root POM that (1) aggregates child modules, and (2) declares a profile that is conditionally activated based on a property value. So:
<packaging>pom</packaging>
<modules>
<module>moduleA</module>
<module>moduleB</module>
<module>moduleC</module>
</modules>
<profiles>
<profile>
<id>myProfile</id>
<activation>
<property>
<name>animal</name>
<value>cat</value>
</property>
</activation>
</profile>
</profiles>
And in moduleA
, I declare the same profile as the parent, and would like it to be activated when I build moduleA
using the activation criteria from the parent (animal == cat
). But that isn't working. So if this is moduleA's POM:
<properties>
<shape>circle</shape>
</properties>
<profiles>
<profile>
<id>myProfile</id>
<properties>
<shape>square</shape>
</properties>
</profile>
</profiles>
And I build moduleA
using mvn help:evaluate -Danimal=cat
, evaluating ${shape}
says its value is circle
, not square
as I'd expect. So it seems like the child profile is not activating when building using its parent's activation criteria.
Is there a way to do this? Do I really have to copy and paste the <activation>
block from the parent into all its children modules, just so I can get the same behavior?