cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carsten Ziegeler <cziege...@apache.org>
Subject Re: [2.2] Configuration
Date Tue, 23 May 2006 13:14:13 GMT
Jorg Heymans schrieb:
> Reinhard Poetz wrote:
> 
>> Suppose you have two environments: development (dev) and production
>> (prod). If you create the web application, you might need different
>> .xconf (database connections, root sitemap, ...) values and different
>> properties.
> 
> ...
> 
>> I propose that we have a directory "src/main/webapp-profiles" that
>> contains all files for different profiles:
>>
>> src/main/webapp-profiles/dev/WEB-INF/xconf/cocoon-sitemap.xconf
>> src/main/webapp-profiles/prod/WEB-INF/conf/cocoon-sitemap.xconf
>> src/main/wenbapp-profiles/dev/WEB-INF/properties/core.properties
>> src/main/wenbapp-profiles/prod/WEB-INF/properties/core.properties
> 
> Just fyi, you can define placeholders a la ${my.db.url} in text files
> and have these replaced by maven during build time.
> 
> So you could do
> 
> <build>
>   <filters>
>     <filter>src/main/filters/${env}.properties</filter>
>   </filters>
>   <resources>
>     <resource>
>         ....
>         <filtering>true</filtering>
>         <includes>**/*.xconf</includes>
>     <resource>
>   <resources>
> </build>
> 
> combined with this in settings.xml:
> 
> <profile>
>   <activation>
>   ....
>   <properties>
>     <env>prod</env>
>   </properties>
> </profile>
> 
> Note that ${env} in the pom is resolved to the <env> property in the
> profile.
> 
> That way you wouldn't have to duplicate your configuration files.
> 
> 
And we don't even need maven for this! Cocoon uses a running mode which can
be set as a system property. The definition for this is free, so we ship
Cocoon currently with the values "prod" and "dev". You can refer to
these values directly from within your xconf or your sitemap and
property replacement is done by Cocoon. So if you use
${org.apache.cocoon.mode} instead of ${env} this should already work
without filtering and doesn't require a rebuild for switching!

Carsten

-- 
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/

Mime
View raw message