Hi,

I had the same requirement and used profiles to achieve this. Depending
on the given parameter, a different extra resource directory is added :
In the WEB-INF/classes, you get the resources from the "resources"
directory plus the resources from the "resources_ENV" directory.


Snippets from my pom, you will have to change a few things to make it
handle you config/<ENV> structure. I would advise to change it to a
src/main/resources_<ENV> though :

        <!-- 
                Adding profiles to handle target environments : LOC,
DEV, INT and PROD
        -->
        <profiles>

                <profile>
                        <id>env-loc</id>
                        <properties>
                                <env>LOC</env>
                        </properties>
                </profile>

                <profile>
                        <id>env-dev</id>
                        <properties>
                                <env>DEV</env>
                        </properties>
                </profile>
                [...]
        </profiles>

        [...]
        
        <build>
                <plugins>
                        <!-- 
                                We separate our web resources in two
directories :
                                * One is the standard and contains file
that are not dependent on the env.
                                * The other is dependent on the
environment, and the right directory is loaded, 
                                according to the 'env' variable, that is
manipulated by maven profiles
        
http://maven.apache.org/plugins/maven-war-plugin/examples/adding-filteri
ng-webresources.html
                        -->
                        <plugin>
        
<groupId>org.apache.maven.plugins</groupId>
        
<artifactId>maven-war-plugin</artifactId>
                                <configuration>
                                        <webResources>
                                                <resource>
                                                        <!-- path is
relative to the pom.xml directory, 
                                                                i.e.
from the parent POM 
                                                                Change
according to your module name
                                                        -->
                                                        <directory>
        
foowar/src/main/webapp_${env}
                                                        </directory>
                                                </resource>
                                        </webResources>
                                </configuration>
                        </plugin>
                </plugins>
        </build>
[...]

You can then build a war for your DEV environment with a "mvn install
-Penv-dev" for exemple.


Hope this helps,
Arnaud Jeansen


-----Original Message-----
From: Maria Odea Ching [mailto:[EMAIL PROTECTED] 
Sent: lundi 28 mai 2007 06:22
To: Maven Users List
Subject: Re: Bundling a particular set of files(Environment) inside War
project


I think what you can do here is put each configuration in a separate 
profile, then you can activate which profile you will use when you build

the project. You can configure the war plugin for each profile and set 
the warSourceIncludes and warSourceExcludes parameters to specify which 
of the config files you want included/excluded in that profile.

HTH,
Deng

Kiran Kodlady wrote:
> Hey..
>
> I have encountered a problem while bundling a particular configuration

> files inside War project: Let me explain in detail on this :
>
>   
>> War project structure is like below :
>>
>>  xyz_War--->config-->  IST-----------------> A bunch of xmls related 
>> to IST phase
>>
>>                            --> UAT----------------->A bunch of xmls 
>> related to UAT phase
>>
>>                             --> PRD----------------->A bunch of xmls 
>> related to PRD phase
>>
>>             -->src-->main-->java 
>>             -->target 
>>             -->webapp-->WEB-INF-->web.xml   
>>
>> Explanation : xyz_War consists of folders like config,
src,webapp,target. 
>>                    config folder consists of different sub folders 
>> related to each testing phase of application(IST,UAT,PRD). These 
>> folders contain same set of files with different contents altogether.
>>
>> For a particular build i need to bundle only one set of files among 
>> IST, UAT or PRD.
>>
>> Hope u got my question. I need to pass this parameter(IST,UAT or PRD)

>> during runtime of build creation.
>>     
>
> Thanks,
>
> Kiran Kodlady
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Ce message et ses pièces jointes (le "message") est destiné à l'usage
exclusif de son destinataire.
Si vous recevez ce message par erreur, merci d'en aviser immédiatement
l'expéditeur  et de le détruire ensuite. Le présent message  pouvant
être altéré à notre insu,  CALYON Crédit Agricole CIB
ne peut pas être engagé par son contenu. Tous droits réservés.

This message and/or any  attachments (the "message") is intended for
the sole use of its addressee.
If you are not the addressee, please immediately notify the sender and
then destroy the message.  As this message and/or any attachments may
have been altered without our knowledge,  its content  is not legally
binding on CALYON Crédit Agricole CIB. All rights reserved.

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

Reply via email to