ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From SimonRichards...@halifax.co.uk
Subject RE: how to set environment variable
Date Mon, 14 May 2001 09:00:11 GMT
Robby

I've tried calling a batch file to set a environment variable, using the
<exec> tags.  But get the same results as you.

If you want to set environment variables and then use then in your ant
build:

(1)In your .bat that you use to call ant you would set ssdir=<some value>
and then call ant.

(2 Your build.xml would look something like this ...

<project name="myProj" default="init" basedir=".">
	<!-- set global properties for this build -->
	<property environment="myenv"/>
	<property name="ssdir"  value="${myenv.ssdir}"/>	

	<target name="init">
		<!-- Display environment variables used here -->
		<echo message="ssdir = ${ssdir}"/>
	</target>
</project>

Hope this helps??

Simon

> -----Original Message-----
> From: robby [mailto:zengzhon@yahoo.com]
> Sent: 14 May 2001 10:01
> To: ant-user@jakarta.apache.org
> Subject: Re: how to set environment variable
> 
> 
> Hi ,
> 
>     I need build.xml to set an environment variable for 
> windows to use,
> actually source safe needs the variable "SSDIR",  if i use
>     <exec executable="cmd.exe" os="Windows 2000">
>        <arg value="/C set ssdir=\\sourcesafe_server\dir"/>
>     </exec>
> it seems not working properly since it will terminate after setting.
> but if I change /C to /K, it doesn't work either, since it cannot
> go back to the current build session...what should i do?
>      thanks for your help...  :-)
> 
> robby
> 
> 
> ----- Original Message -----
> From: <Arvid.Amundsen@sas.no>
> To: <ant-user@jakarta.apache.org>
> Sent: Monday, May 14, 2001 4:41 PM
> Subject: RE: how to set environment variable
> 
> 
> > Hi.
> > I'm not sure if I understand exactly what you mean...
> > Do you want build.xml to use an environment variable from 
> windows, or do
> you
> > want build.xml to set an environment variable for windows to use?
> >
> > By the way: What version of windows are you using...
> >
> > -- Arvid
> >
> > -----Original Message-----
> > From: robby [mailto:zengzhon@yahoo.com]
> > Sent: Monday, May 14, 2001 10:25
> > To: ant-user@jakarta.apache.org
> > Subject: how to set environment variable
> >
> >
> > Hi all,
> >
> >      I'm a new user of ant, just want to know what the tag i need
> > to use to set an environment variable in windows. it works just
> > as typing
> >          set a=b
> > in Dos prompt.
> >      Can anyone help me? thanks.
> >
> > robby
> >
> >
> > _________________________________________________________
> > Do You Yahoo!?
> > Get your free @yahoo.com address at http://mail.yahoo.com
> 
> 
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
> 
> 

------------------------------------------------------------------------------
Part of the Halifax Group, Halifax plc, Registered in England No. 2367076.  Registered Office:
Trinity Road, Halifax, West Yorkshire HX1 2RG. Represents only the Halifax Financial Services
Marketing Group for the purposes of advising on and selling life assurance, pensions and unit
trust business.  The Marketing Group is regulated by the Personal Investment Authority.  Switchboard
01422 333333.


==============================================================================


Mime
View raw message