The reason that it did not work (possibly...) is
becuase you forget the
   <property environment="env"/>

call at the beginning.


--- Rakesh Patel <[EMAIL PROTECTED]> wrote:

> Hi James,
> 
> Both your links point to the same resource (the
> first hit in google).
> 
> However, this does not work for me(on Windows):
> 
> <!-- Capture the computer name in a cross-platform
> manner -->
> <property name="env.COMPUTERNAME"
> value="${env.HOSTNAME}"/>
> <property file="${env.COMPUTERNAME}.properties"/>
> <property file="build.properties" />
> <echo>${env.COMPUTERNAME}</echo>
> 
> [echo] ${env.HOSTNAME}
> 
> Cheers
> 
> Rakesh
> 
> 
> -----Original Message-----
> From: James Abley [mailto:[EMAIL PROTECTED] 
> Sent: 07 October 2005 16:28
> To: Ant Users List
> Subject: RE: Help with choosing build property file
> 
> 
> Google is your friend.
> 
>
http://www.google.co.uk/search?hl=en&q=ant+computername+hostname
> 
> First link:
> 
>
http://www.ehatchersolutions.com/JavaDevWithAnt/ant.html
> 
> I would expect something like this to work on
> Windows and Solaris, but I use Linux rather than
> Solaris.
> 
> James
> 
> On Fri, 2005-10-07 at 16:23, Erskine, Chris wrote:
> > I do something like this.  Since each machine is
> set up differently, I 
> > have a properties file that I put into the root
> directory.  This 
> > allows me to then have machine dependent
> properties on each machine 
> > and my build script knows where to find the file
> for it.  In this 
> > file, you could put your hostname that is then
> used to get the 
> > hostname.properties file.
> > 
> > Chris Erskine
> >  
> > EDS Consulting Services
> > Colorado Springs, CO
> >  
> > Phone: 719-265-5962
> > Cell: 719-640-6488
> > 
> > -----Original Message-----
> > From: Rakesh Patel
> [mailto:[EMAIL PROTECTED]
> > Sent: Friday, October 07, 2005 9:16 AM
> > To: Ant Users List
> > Subject: RE: Help with choosing build property
> file
> > 
> > Hi Jan,
> > 
> > That looks promising. Is there a way to make it
> work on both windows 
> > and unix? I develop on windows and deploy to
> solaris.
> > 
> > Thanks
> > 
> > Rakesh
> > 
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> > Sent: 07 October 2005 15:52
> > To: user@ant.apache.org
> > Subject: AW: Help with choosing build property
> file
> > 
> > 
> > <!-- set property 'computername' -->
> > <propery file="${computername}.properties"/>
> > <propery file="default.properties"/> 
> > 
> > Because properties are immutable the more specific
> values in the first 
> > file are prefered. If that file does not exist (eg
> ${computername} is 
> > not set) it does not matter.
> > 
> > You have to set the property 'computername'. On
> WinXP you can use a 
> > env variable: <property environment="env"/>
> <property 
> > name="computername" value="${env.COMPUTERNAME}"/>
> > 
> > 
> > Jan
> > 
> > 
> > 
> > >-----Ursprüngliche Nachricht-----
> > >Von: Rakesh Patel
> [mailto:[EMAIL PROTECTED]
> > >Gesendet: Freitag, 7. Oktober 2005 16:40
> > >An: user@ant.apache.org
> > >Betreff: Help with choosing build property file
> > >
> > >Hi,
> > >
> > >I would like to enhance my current Ant setup and
> was looking for 
> > >advice.
> > >
> > >At the moment, Ant picks up the build.properties
> file in the root 
> > >directory and uses that:
> > >
> > ><property file="build.properties" />
> > >
> > >However, what I would like to do is this:
> > >
> > >1. Ant gets the machine name/IP address of the
> machine it is running 
> > >on. 2. Based on the answer to (1), a particular
> property file is
> > >chosen and used.
> > >3. If no machine name/ip address match a default
> property file is used.
> > >
> > >Is this doable? I saw a configuration like this
> once but it was done 
> > >in Perl.
> > >
> > >Thanks
> > >
> > >Rakesh
> > >
> > >
> > >American Express Investments and American Express
> Independent 
> > >Financial Advisers are marketing names for
> American Express Financial 
> > >Services Europe Limited, a separate corporation
> within the American 
> > >Express group of companies.  American Express
> Financial Services 
> > >Europe Limited is authorised and regulated by,
> and is entered into 
> > >the register (No. 190853
> > >www.fsa.gov.uk/register/) of, the Financial
> Services Authority
> > >and a member of the London Stock Exchange.
> Registered in 
> > >England No. 3614902. Registered address: 230
> Blackfriars Road, 
> > >London SE1 8NW. Vat No. 740 4143 68. 
> > >
> > >The information in this email and any attachments
> is confidential and 
> > >intended solely for the attention and use of the
> named addressee(s). 
> > >It may be subject to legal, professional or other
> privilege and 
> > >further distribution of it is strictly prohibited
> without our 
> > >authority.  If you are not the intended
> recipient, you are not 
> > >authorised to and must not disclose, copy,
> distribute, or retain this 
> > >message or any part of it, and should notify us
> immediately.
> > >
> > >
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED]
> > 
> > 
> > 
> > American Express Investments and American Express
> Independent 
> > Financial Advisers are marketing names for
> American Express Financial Services Europe Limited,
> a separate corporation within the American Express
> group of companies.  American Express Financial
> Services Europe Limited is authorised and regulated
> by, and is entered into the register (No. 190853
> www.fsa.gov.uk/register/) of, the Financial Services
> Authority and a member of the London Stock Exchange.
> Registered in England No. 3614902. Registered
> address: 230 Blackfriars Road, London SE1 8NW. Vat
> No. 740 4143 68.
> > 
> > The information in this email and any attachments
> is confidential and 
> > intended solely for the attention and use of the
> named addressee(s). 
> > It may be subject to legal, professional or other
> privilege and 
> > further distribution of it is strictly prohibited
> without our 
> > authority.  If you are not the intended recipient,
> you are not 
> > authorised to and must not disclose, copy,
> distribute, or retain this 
> > message or any part of it, and should notify us
> immediately.
> > 
> > 
> >
>
---------------------------------------------------------------------
> > 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]
> > 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 
> 
> American Express Investments and American Express
> Independent Financial Advisers are marketing names
> for American Express Financial Services Europe
> Limited, a separate corporation within the American
> Express group of companies.  American Express
> Financial Services Europe Limited is authorised and
> regulated by, and is entered into the register (No.
> 190853 www.fsa.gov.uk/register/) of, the Financial
> Services Authority and a member of the London Stock
> Exchange. Registered in England No. 3614902.
> Registered address: 230 Blackfriars Road, London SE1
> 8NW. Vat No. 740 4143 68. 
> 
> The information in this email and any attachments is
> confidential and intended solely for the attention
> and use of the named addressee(s). It may be subject
> to legal, professional or other privilege and
> further distribution of it is strictly prohibited
> without our authority.  If you are not the intended
> recipient, you are not authorised to and must not
> disclose, copy, distribute, or retain this message
> or any part of it, and should notify us immediately.
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 






                
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to