ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Wilkes <pwil...@cowpie.acm.vt.edu>
Subject RE: auto configuration
Date Fri, 22 Oct 2004 11:47:43 GMT
Jeff,

	Yes thank you. this is very helpful. i appreciate the quick
response.

thank you

PEte

On Thu, 21 Oct 2004, Jeff Davidson wrote:

> Would it not be possible to load the customized properties for a site, and
> then load the default properties after?  That would allow you to take
> advantage of the immutability of properties instead of it being a hindrance.
>
> Here's a sample:
>
> build.xml
> =========
>
> 	<project name="Properties test" default="build">
>
> 		<!-- Load the customized properties first. -->
> 		<property file="site1.properties" />
> 		<!-- Then load the default properties. -->
> 		<property file="default.properties" />
>
> 		<target name="build">
> 			<echo>option1=${option1}</echo>
> 			<echo>option2=${option2}</echo>
> 			<echo>option3=${option3}</echo>
> 		</target>
>
> 	</project>
>
> default.properties
> ==================
>
> 	option1=standard
> 	option2=standard
> 	option3=standard
>
> site1.properties
> ================
>
> 	option2=customized for site1
>
> And the output from Ant:
> ========================
>
> 	Buildfile: D:\workspace\anttests\build.xml
> 	build:
> 		 [echo] option1=standard
> 		 [echo] option2=customized for site 1
> 		 [echo] option3=standard
> 	BUILD SUCCESSFUL
> 	Total time: 422 milliseconds
>
>
> Hopefully this provides something to get you started.
>
> Regards,
> ~Jeff
>
>
> -----Original Message-----
> From: Pascal_Lafond@cwb.ca [mailto:Pascal_Lafond@cwb.ca]
> Sent: October 21, 2004 15:01
> To: user@ant.apache.org
> Cc: user@ant.apache.org
> Subject: Re: auto configuration
>
>
> Properties in ant are immutable.
>
> If you need to change a property (which is sometimes unavoidable) you will
> to include the 3rd party open source antcontrib library and use the variable
> task.
>
> I every site needs to replace a certain set of variables maybe they don't
> need to be present in global properties file. I wrote a system where it
> ready a global properties file then an environment properties file (which
> depended on which environment I was deploying to prod, test, dev) but I did
> not have any overlapping properties in the two.
>
> Good Luck
> Pascal
>
>
>
>
>
>                       "Peter Wilkes"
>
>                       <pwilkes@cowpie.a        To:       user@ant.apache.org
>
>                       cm.vt.edu>               cc:
>
>                                                Subject:  auto configuration
>
>                       10/21/2004 01:57
>
>                       PM
>
>                       Please respond to
>
>                       "Ant Users List"
>
>
>
>
>
>
>
>
>
>
> hello!
>
> i just convinced my project to user ant. they think it is a great tool and
> we are currently trying to move all our build scripts over.
>
> i have a question however.
>
> our application only gets delivered to currently 5 locations. (it's a
> specialized program) and we would like to make a configuration file for each
> site.
>
> right now we have a general properties file called "program.properties"
> and we have an install proceedure to change certain lines.
>
> we would like to set up ant persay to read in another file called
> "site1.properties" read in all the properties and automatically change the
> values to the proper values need for site1 in program.properties.
>
> ex.
> in program.properties
> ------
> option1= OPTION1_REPLACE
> option2= OPTION2_REPLACE
> --------
>
> then in site1.properties
> -------
> option1=text
> option2=othertext
> -------
>
>
> the reason is 3 fold. 1. our config fil is 70% the same for each site and 2.
> reduce error on install instructions. 3. we have 3 different configuration
> files for 3 different sections of the program (don't ask me
> why) and i figured instead of creating 15 configuration files then i would
> have 8 files. 3 config files and 1 for each site with the replacements to
> make.
>
> i;ve been suggested to create a
>
> site1.program.properties
> site2.program.properties
>
> and copy the appropriate properties file in the build script however i
> believe this would be bad since a developer might forget to  update all 15
> files.
>
>
> thanks for any help!
>
> Pete
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message