You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Morgan Fletcher <mo...@luna.com> on 2000/08/09 00:44:42 UTC

Simple exec question

I'm evaluating ant, and I've hit a strange little problem. I've created a
build.xml like so:

  <project name="Gimondi" default="main" basedir=".">
  
    <property name="Name" value="Gimondi"/>
    <property name="name" value="gimondi"/>
  
    <property name="platform.home" value="\\server\foo\bar"/>
  
    <target name="main">
      <exec dir="${basedir}" command="dir ${platform.home}"
output="dir.txt"/>
    </target>
  
  </project>

If I execute 'ant' in the same directory as build.xml, I get:

  Buildfile: build.xml
  
  main:
  
  BUILD FAILED
  
  build.xml:9: Error exec: dir \\server\foo\bar
  java.io.IOException: CreateProcess: dir \\server\foo\bar  error=2
  	at java.lang.Win32Process.create(Native Method)
  	at java.lang.Win32Process.<init>(Win32Process.java:64)
  	at java.lang.Runtime.execInternal(Native Method)
  	at java.lang.Runtime.exec(Runtime.java:272)
  	at java.lang.Runtime.exec(Runtime.java:195)
  	at java.lang.Runtime.exec(Runtime.java:152)
  	at org.apache.tools.ant.taskdefs.Exec.run(Exec.java:124)
  	at org.apache.tools.ant.taskdefs.Exec.execute(Exec.java:77)
  	at org.apache.tools.ant.Target.execute(Target.java:132)
  	at org.apache.tools.ant.Project.runTarget(Project.java:717)
  	at org.apache.tools.ant.Project.executeTarget(Project.java:448)
  	at org.apache.tools.ant.Project.executeTargets(Project.java:422)
  	at org.apache.tools.ant.Main.runBuild(Main.java:279)
  	at org.apache.tools.ant.Main.main(Main.java:107)
  
  Total time: 0 seconds
  
If I change the "dir" attribute to be "\", it completes successfully, and I
find a dir.txt  in the current directory, containing the directory listing
of platform.home. The command 'ant -version' reports "Ant version 1.1
compiled on August 2 2000". I downloaded this source from
http://jakarta.apache.org/builds/ant/release/v1.1/src/jakarta-ant.zip. I'm
running w2k. It doesn't seem to matter whether I set the os="Windows NT"
(the value of os.name) or not.

Why don't dir="${basename} or dir="." work?

morgan