forrest-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ross Gardler <>
Subject Re: deploying forrest with environment variables
Date Fri, 24 Feb 2006 12:19:18 GMT
Gilles VANDAELE wrote:
> Ross Gardler <rgardler <at>> writes:
>>Gilles VANDAELE wrote:
>>>I'd like to deploy forrest as a webapp, and include the environment as a
>>>parameter in the command line. This parameter should be used to set some
>>>variable in the site.xml, depending on the environment targeted.
>>>Any way to pass variable from Ant to site.xml?
>>I'm not aware of any easy way to do this in 0.7, it can be done in 
>>0.8-dev very easily.
>>Do you want the hard way (0.7) or the easy way (0.8-dev)?
>>Either way, please provide a speicifc example of what you want to do, 
>>i.e. what property, how will it be used. Please provide code where 
>>possible, it prevents confusion in the explanation.
> I prefer the hard way ;.)

Glutten for punishment eh?

> In my site.xml, some part of href attributes needs to be set to the right server
> adress.
> In the xml:
> <site ...>
> 	<external-refs>
> 		<mySite href="http://localhost:8080/"/>
> 	</external-refs>
> </site>
> I would like to replace the 'localhost' and the '8080' by some environment
> parameters comming from the command line used to build the war, or coming from
> properties choosen with this parameter.

Before I go into the solution I have in mind let me ask a couple of 
questions, I'm not sure an "environment parameter" is the right idea.

Since you are building a war the values are static once built. So why 
not just change them in the site.xml file before they are built?

You could do this manually each time it is built, or, if you need to 
automate it you could write an ANT task that takes the property value 
from the command line, builds the correct site.xml file using filtersets 
and then continues with a normal forrest build.

See for more info 
To see a fairly clear example of how to use this take a look at the 
seed-plugin template in "FORREST_HOME/plugins/build.xml".

Doing it this way means that you don't have to play with Forest core, so 
you get easier upgrades between Forrest versions.


View raw message