ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject RE: Setting environment variables
Date Wed, 17 Sep 2003 08:56:18 GMT
Maybe you expectes something others:

build.xml
---------
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="test" basedir="." default="main">
    <target name="main">

        <!-- without setting -->
        <exec executable="cmd.exe">
            <arg line="/C batch.cmd"/>
        </exec>

        <!-- with setting -->
        <exec executable="cmd.exe">
            <arg line="/C batch.cmd"/>
            <env key="SERVER_HOME" value="MyServerHome"/>
        </exec>

    </target>
</project>


batch.cmd
---------
@echo off
echo SERVER HOME is %SERVER_HOME%


output
------
Buildfile: build.xml

main:
     [exec] SERVER HOME is

     [exec] SERVER HOME is MyServerHome

BUILD SUCCESSFUL


That´s exactly what _I_ expect.


Jan


> -----Original Message-----
> From: Rose, Angus H [mailto:angus.rose@eds.com]
> Sent: Wednesday, September 17, 2003 10:42 AM
> To: 'Ant Users List'
> Subject: RE: Setting environment variables
> 
> 
> Hi Jan, 
>       thanks for the reply. I've tried the snippet but it 
> doesn't actually
> add the SERVER_HOME to the .cmd script. Is there a way of doing this?
> 
> Many thanks
> 
> Angus
> 
> -----Original Message-----
> From: Jan.Materne@rzf.fin-nrw.de [mailto:Jan.Materne@rzf.fin-nrw.de]
> Sent: 16 September 2003 09:28
> To: user@ant.apache.org
> Subject: RE: Setting environment variables
> 
> 
> Check whether exists
> 
>     <!-- access to environment variables -->
>     <property environment="env"/>      <!-- 'env' is a common 
> prefix -->
> 
>     <!-- check -->
>     <fail message="SERVER_HOME not defined" unless="env.SERVER_HOME"/>
> 
> Add to startupscript
>     
>     I think you will start the script via <exec>. Therefore 
> you can use
> 
>     <exec executable="cmd.exe">        <!-- your script has 
> suffix .cmd
> therefore windows -->
>         <arg line="/C thescript.cmd"/>
>         <env key="SERVER_HOME" value="c:/path/to/server"/>
>     </exec>
> 
> 
> Jan
> 
> 
> 
> 
> > -----Original Message-----
> > From: Rose, Angus H [mailto:angus.rose@eds.com]
> > Sent: Tuesday, September 16, 2003 10:22 AM
> > To: 'user@ant.apache.org'
> > Subject: Setting environment variables
> > 
> > 
> > Hi All,
> >         I'm new to Ant and need to know how to do the 
> > following: How to
> > check to see if an environment variable exists on a user's 
> > machine and if
> > it's not present, how would I add it to a startup script such as the
> > startweblogic.cmd script?
> > 
> > Thanks in advance
> > 
> > Angus Rose
> > 
> > 
> ---------------------------------------------------------------------
> > 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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message