Any ideas on how to accomplish this?



torghal wrote:
> 
> We have 3 different kind of enviroments to deploy applications:
>       - development
>       - acceptation
>       - production
> 
> We would like to use 3 different propertie files, one for each enviroment:
>       - development.properties
>       - acceptation.properties
>       - production.properties
> 
> These propertie files contain enviroment specific properties (e.g.
> context-root under which the application is deployed).
> 
> We addapted the maven.xml so we can use a commandline parameter to switch
> between the different propertie files:
> 
>       <preGoal name="build:start">
>               <attainGoal name="select:properties"/>
>       </preGoal>
> 
>       <goal name="select:properties">
>               <ant:echo>Loading properties</ant:echo>
>               <ant:echo>Omgeving: ${enviroment}</ant:echo>
>               <j:switch on="${enviroment}">
>                       <j:case value="production">
>                               <ant:property 
> file="${basedir}/../production.properties" />
>                       </j:case>
>                       <j:case value="acceptation">
>                               <ant:property 
> file="${basedir}/../acceptation.properties" />
>                       </j:case>
>                       <j:default>
>                               <ant:property 
> file="${basedir}/../development.properties" />
>                       </j:default>
>               </j:switch>
>       </goal>
> 
> This loads the properties correctly, <ant:echo>Server is:
> ${server.name}</ant:echo> will echo the server name as defined according
> to
> the commandline parameter.
> 
> The properties loaded this way can however not be used by other plugins:
> 
>       - in the project.xml we have:
> 
>               <dependency>
>                       <groupId>${pom.groupId}</groupId>
>                       <artifactId>mmis_imjv_beheer_war</artifactId>
>                       <version>${pom.currentVersion}</version>
>                       <type>war</type>
>                       <properties>
> 
> <ear.appxml.war.context-root>${webapp.context.beheer}</ear.appxml.war.contex
> t-root>
>                               <ear.bundle>true</ear.bundle>
>                       </properties>
>               </dependency>
> 
>       - in the project.properties file we have:
> 
>               webapp.context.beheer=/${server.name}/imjv-beheer
> 
>       - in the development.properties file we definied:
> 
>               server.name=development
> 
> When we run the ear:install goal we see in the application.xml that the
> context-root is /imjv-beheer instead of /developement/imj-beheer
> 
> It likes like the properties in the development.properties file where not
> loaded for the ear-plugin.  Is there a way to "pre-load" the properties in
> the development.properties file or is there another way to solve the
> "switching enviroments" problem.
> 
> Many thanks,
> 
> Tonny
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Loading-properties-for-different-enviroments-tf373481.html#a6566611
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