ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Berry <christopher.be...@etrade.com>
Subject RE: Setting a W2K environment variable from build.xml
Date Tue, 31 Jul 2001 14:18:49 GMT
I believe you must call "cmd" and pass it a "/c" option (w/ your set command
here)-- Or else make a BAT file and call it w/ the "/c". 
Cheers,
-- Chris

> -----Original Message-----
> From: Prabhakar Chaganti [mailto:prabhakar@chaganti.net]
> Sent: Tuesday, July 31, 2001 9:10 AM
> To: ant-user@jakarta.apache.org
> Subject: Setting a W2K environment variable from build.xml
> 
> 
> Hi all:
> 
> I am using ant version 1.4alpha on Win2K running JDK 1.3.0.
> 
> I need to set an environment variable in W2K such as APP_HOME, 
> before my task executes. This can be done from a shell by doing:
> 	"set APP_HOME=c:\apphome"
> 
> I am trying to use the following fragment to accomplish the same 
> thing from inside my build.xml:
> 	    <target name="test">
>         		<exec executable="set" os="Windows 2000">
>             		<arg line="APP_HOME=c:\apphome" />
>         		</exec>
>     		</target>
> 
> This fails with the following error:
>         Execute failed: java.io.IOException: CreateProcess: 
> set 		
> 		APP_HOME=c:\apphome error=2
>         --- Nested Exception ---
>         java.io.IOException: CreateProcess: set 		
> 				
> 			APP_HOME=c:\apphome error=2
>                 at java.lang.Win32Process.create(Native Method)
>                 at java.lang.Win32Process.<init>(Win32Process.java:66)
>                 at java.lang.Runtime.execInternal(Native Method)
>                 at java.lang.Runtime.exec(Runtime.java:551)
>                 at java.lang.reflect.Method.invoke(Native Method)
>                 at 						
> 				
> org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.ex
> ec(Execute.java:564)
>                 at 
> org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:384)
>                 at 
> org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:2
> 38)
>                 at 
> org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:254)
>                 at 
> org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:165)
>                 at org.apache.tools.ant.Task.perform(Task.java:240)
>                 at 
> org.apache.tools.ant.Target.execute(Target.java:164)
>                 at 
> org.apache.tools.ant.Target.performTasks(Target.java:182)
>                 at 
> org.apache.tools.ant.Project.executeTarget(Project.java:568)
>                 at 
> org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:252)
>                 at 
> org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:120)
>                 at org.apache.tools.ant.Task.perform(Task.java:240)
>                 at 
> org.apache.tools.ant.Target.execute(Target.java:164)
>                 at 
> org.apache.tools.ant.Target.performTasks(Target.java:182)
>                 at 
> org.apache.tools.ant.Project.executeTarget(Project.java:568)
>                 at 
> org.apache.tools.ant.Project.executeTargets(Project.java:527)
>                 at org.apache.tools.ant.Main.runBuild(Main.java:453)
>                 at org.apache.tools.ant.Main.start(Main.java:154)
>                 at org.apache.tools.ant.Main.main(Main.java:177)
> 
> 
> Can anyone point out what is wrong with the xml. I looked at the list 
> archives, and some people suggested using a batch file just to set 
> the environment variables. Is this the only option ?
> 
> Any info truly appreciated.
> 
> thanks
> prabhakar
> 
> 
> 

Mime
View raw message