ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <aslak.helle...@netcom.no>
Subject Re: ant 1.2, jdk1.3, copy
Date Mon, 26 Feb 2001 17:59:59 GMT
Why don't you use ant's built-in copy task? I presume the answer is: 
you're experimenting with exec, not really trying to copy..

Anyway, the answer to your question has nothing to do with Ant, but 
actually windows! copy is one of the windows command interpreter 
commands, not an executable. Therefore, you can't start it as a 
separate command. Try this: (or "command.com" on win 9x, I think)

  <target name="stupidcopy">
    <exec dir="." executable="cmd.exe">
       <arg value="/C"/>
       <arg value="copy"/>
       <arg value="fromfile"/>
       <arg value="tofile"/>
    </exec>
  </target>

But don't ever use it. You're breaking crossplatform compatibility by 
abusing the exec task. Avoid it if you can.

----- Original Message -----
From: Peter Alfors <peter.alfors@irista.com>
Date: Monday, February 26, 2001 6:15 pm
Subject: ant 1.2, jdk1.3, copy

> Hello all,
> 
>    I am new to the list, and hope that you can help.  I checked the
> archives, but did not see anything about this.
> I am using Ant 1.2, JDK 1.3, and and attempting to use the <EXEC> task
> to perform a file copy.
> In JDK1.2.2, everything worked fine.  However, now that I have 
> switchedto JDK1.3, I get the following error...
> 
> 
> C:\dvlp\iristaVision\webapps\iristavision\bin\build.xml:128: Execute
> failed:
> java.io.IOException: CreateProcess: copy
> 
C:\dvlp\iristaVision\webapps\iristavision\resources\dbfields.properties
> 
C:\dvlp\iristaVision\webapps\iristavision\build\classes\com\irista\ui\di
ctionary\dictionary.properties
> error=2
> java.io.IOException: CreateProcess: copy
> 
C:\dvlp\iristaVision\webapps\iristavision\resources\dbfields.properties
> 
C:\dvlp\iristaVision\webapps\iristavision\build\classes\com\irista\ui\di
ctionary\dictionary.properties
> 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.exec(Exec
> ute.java:390)
>        at
> org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:247)
>        at
> org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:213)
>        at
> org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:154)
>        at org.apache.tools.ant.Target.execute(Target.java:142)
>        at org.apache.tools.ant.Project.runTarget(Project.java:818)
>        at 
> org.apache.tools.ant.Project.executeTarget(Project.java:532)       
> at org.apache.tools.ant.Project.executeTargets(Project.java:506)
> 
>        at org.apache.tools.ant.Main.runBuild(Main.java:420)
>        at org.apache.tools.ant.Main.main(Main.java:149)
> 
> Total time: 2 seconds
> 
> 
> -- my task --
>  <property name="dictionary.ext"   value=".properties"/>
>  <property name="dictionary.lang1" value=""/>
>  <property name="dictionary.src1"
> value="${app.dictionary.dir}${ps}dbfields"/>
>  <property name="dictionary.src2"
> value="${app.dictionary.dir}${ps}pages"/>
>  <property name="dictionary.src3"
> value="${app.dictionary.dir}${ps}errors"/>
>  <property name="dictionary.src4"
> value="${app.dictionary.dir}${ps}codes"/>
>  <property name="dictionary.src5"
> value="${uibase.dictionary.dir}${ps}uiframework_errors"/>
> 
>    <exec dir="." executable="copy">
>           <arg
> value="${dictionary.src1}${dictionary.lang1}${dictionary.ext}
+${dictionary.src2}${dictionary.lang1}${dictionary.ext}
+${dictionary.src3}${dictionary.lang1}${dictionary.ext}
+${dictionary.src4}${dictionary.lang1}${dictionary.ext}
+${dictionary.src5}${dictionary.lang1}${dictionary.ext}"/>
> 
>           <arg
> value="${build.dictionary.dir}${ps}dictionary${dictionary.lang1}
${dictionary.ext}"/>
> 
>    </exec>
> 
> Any help would be greatly appreciated!
>    Pete
> 


Mime
View raw message