Reputation: 3207
Hi I've parent pom.xml like below.. , say I've 4 modules currently.. But at certain times I might not have all the 4 modules all the time.. Is there any way to make these module(s) (Child projects) optional within root pom.xml. Which means that child project will not be present in the one branch , but will be present in another branch .. I don't want to use multiple root pom.xml's for different branches.. Is it possible?
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.xx.xx.correspondence</groupId>
<artifactId>xxHudsonTP</artifactId>
<version>1</version>
<packaging>pom</packaging>
<modules>
<module>xxCastor</module>
<module>cxxYYYCastor</module>
<module>xxCommon</module>
<module>xxxx</module>
</modules>
</project>
Upvotes: 12
Views: 7028
Reputation: 120881
You can use profiles, like they did it for example in flex-mojos plugin project:
...
<profiles>
<profile>
<id>minimal</id>
<modules>
<module>flexmojos-parent</module>
<module>flexmojos-sandbox</module>
<module>flexmojos-generator</module>
<module>flexmojos-maven-plugin</module>
<module>flexmojos-super-poms</module>
<module>flexmojos-testing</module>
</modules>
</profile>
<profile>
<id>release</id>
<modules>
<module>flexmojos-parent</module>
<module>flexmojos-sandbox</module>
<module>flexmojos-generator</module>
<module>flexmojos-maven-plugin</module>
<module>flexmojos-super-poms</module>
<module>flexmojos-archetypes</module>
<module>flexmojos-testing</module>
</modules>
</profile>
<profiles>
Upvotes: 12