开发者

Maven Modules optional in pom.xml

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> 


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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜