Rob and all,
That's exactly what i was looking for. I think
properties file is the way to go in my case.
Best,
James
--- "Anderson, Rob (Global Trade)"
<[EMAIL PROTECTED]> wrote:
> This is certainly possible. Depending on what
> exactly you are trying to do, your method to acheive
> it may differ. Here is one method I use to get the
> same thing done in different environments.
>
> I create a properties file for each environment:
> dev.properties
> test.properties
>
> In the properties files, I put environment specific
> stuff, like the following:
> dev.properties
> ###############
> HOSTNAME=localhost
> DEPLOYPATH=C:\some\path\to\deploy\stuff\
> DOSOMETHING=TRUE
>
> Then I would have a build.xml that looks like this:
>
> <project name="example" default="build">
> <available file="${env}.properties"
> property="prop.file.exists"/>
> <fail unless="prop.file.exists">Can't find
> ${env}.properties</fail>
> <property file="${env}.properties"/>
>
> <target name="build" depends="dosomething">
> <!-- Do stuff here using the properties set in
> ${env}.properties -->
> </target>
>
> <target name="dosomething" if="DOSOMETHING">
> <!-- Do not set DOSOMETHING in the
> ${env}.properties if you don't need this done. -->
> </target>
> </project>
>
> Then I call ant with the following command:
> ant -Denv=dev build\
>
> The dosomething target will always get called, but
> will only execute if the DOSOMETHING property is
> set. So I don't set this in test.properties,
> perhaps.
>
> I hope this helps,
>
> -Rob Anderson
>
> > -----Original Message-----
> > From: klute [mailto:[EMAIL PROTECTED]
> > Sent: Monday, March 07, 2005 2:32 PM
> > To: [email protected]
> > Subject: logic using ant
> >
> >
> > hey guys
> >
> > i have a dev and test environments with the former
> > being on win xp and the latter on linux. i am
> trying
> > to put some logic within my build target to do
> things
> > differently. i'd like to do this to avoid separate
> > targets for dev and text environments. here is
> some
> > basic pseudo code of what i am trying to achieve:
> >
> > if some env variable indicates that the script is
> > running in windows env {
> > do this
> > } else {
> > do that
> > }
> >
> > is this possible?
> >
> > thanks a lot!
> > james
> >
> >
> >
> >
> > __________________________________
> > Celebrate Yahoo!'s 10th Birthday!
> > Yahoo! Netrospective: 100 Moments of the Web
> > http://birthday.yahoo.com/netrospective/
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED]
> >
> >
> >
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]