Good day to you, Ravi,

AFAIK, you cannot exclude a module from your build. However, what you can do
is to include modules.

Thus, you could simply create something like..

<?xml version="1.0" encoding="UTF-8" ?>

<project>
  ...
  <modules>
    <module>module3</module>
    <module>module4</module>
  </modules>

  <profiles>
    <profile>
      <id>cpp-qa</id>
      <modules>
        <module>module1</module>
        <module>module2</module>
      </modules>
    </profile>
  </profiles>
  ...
</project>


This would then build modules module3 and module4 by default, unless you
specify -Pccp-qa so that modules module1 to module4 gets build. 

But if you want your default build to include module1 and module2, and
simply exclude them on certain occassions, then you can do something like...


<project>
  ...
  <modules>
    <module>module3</module>
    <module>module4</module>
  </modules>

  <profiles>
    <profile>
      <activation>
        <property>
          <name>!exclude-cpp-qa</name>
        </property>
      </activation>
      <modules>
        <module>module1</module>
        <module>module2</module>
      </modules>
    </profile>
  </profiles>
  ...
</project>

The pom above builds modules module1 to module4 by default ( since by
default, the property exclude-cpp-qa is not defined ), and will build
modules module3 and module4 only if exclude-cpp-qa is defined ( i.e. mvn
clean install -Dexclude-cpp-qa ).

See [1] and [2] for more info.

Cheers,
Franz

[1]
http://maven.apache.org/guides/introduction/introduction-to-profiles.html
[2] http://docs.codehaus.org/display/MAVENUSER/Profiles


Balasubramanian, Ravi Shankar wrote:
> 
> Hi,
> 
> I am using maven 2.0.4 and I want to be excluding certain modules while
> building my project in a certain profile. Following is the scenarion:
> 
>  
> 
> This is how my main pom looks like:
> 
>  
> 
> <?xml version="1.0" encoding="UTF-8" ?>
> 
> <project xmlns="http://maven.apache.org/POM/4.0.0";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> 
>     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd";>
> 
>     <modelVersion>4.0.0</modelVersion>
> 
>     <groupId>com.informatica.metadatarepository.qa</groupId>
> 
>     <artifactId>metamodels</artifactId>
> 
>     <packaging>pom</packaging>
> 
>     <name>${artifactId}</name>
> 
>     <modules>
> 
>               <module>module1</module>
> 
>               <module>module2</module>
> 
>               <module>module3</module>
> 
>               <module>module4</module>
> 
>      </modules>
> 
>  
> 
>      <profiles>
> 
>          <profile>
> 
>            <id>cpp-qa</id>
> 
>            <modules>
> 
>               <module>module3</module>
> 
>               <module>module4</module>
> 
>            </modules>
> 
>     </profile>
> 
> </profiles>
> 
>  
> 
>  
> 
> With the above pom, when I build the project activating the profile
> "cpp-qa", all the four modules are being built. I want to be building
> only module3 and module4 using certain configurations in this profile.
> Is there a way by which I can accomplish this in maven2?
> 
>  
> 
>  
> 
> Thanks for any help,
> 
> Ravi.
> 
> "Tough times never last, but tough men do..."
> 
>  
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Excluding-certain-modules-in-a-profile-tf3185303s177.html#a8845843
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to