Hi,
I'm new to
Ant. I'm trying to run a Perl script (using exec) from Ant. I get
alot of errors that you can see below. I'm running Ant 1.6.1 and active state Perl v5.8.0 built for MSWin32-x86-multi-thread, working on Windows.
The first part of my build script is:
<project name="HelloWorld" default="compile">
<description>
very simple
test </description>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
</target>
<property name="ViewName" value="sheila_temp"/>
<target name="create_view" depends="init">
<!-- Building MAPI -->
<exec dir="c:\scripts"
executable="perl c.pl" os="Windows 2000" output="output2.txt">
</exec>
</target>
I've also tried "executable="c.pl"", but that didn't work either. I can run the Perl script by itself from a DOS prompt. I'm trying to run a Perl script called c.pl from c:\scripts.
The errors I get are below:
C:\temp2>ant -v
Apache Ant version 1.6.1 compiled on February 12 2004
Buildfile: build.xml
Detected
Java version: 1.4 in: c:\j2sdk1.4.2_04\jre
Detected OS: Windows 2000
parsing buildfile C:\temp2\build.xml with URI =
file:///C:/temp2/build.xml Project base dir set to: C:\temp2
Build sequence for target `compile' is [init, create_view, compile]
Complete build sequence is [init, create_view, compile, ]
init:
create_view:
[exec] Current OS is Windows 2000
[exec] Output redirected to C:\temp2\output2.txt
[exec] Executing 'perl c.pl' with
BUILD FAILED
C:\temp2\build.xml:18: Execute failed: java.io.IOException: CreateProcess: "perl
c.pl" error=2
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:569)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:415)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:301)
at org.apache.tools.ant.Target.performTasks(Target.java:328)
at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
at org.apache.tools.ant.Main.runBuild(Main.java:632)
at org.apache.tools.ant.Main.startAnt(Main.java:183)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
Caused by: java.io.IOException: CreateProcess: "perl c.pl" 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:566)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Exec
ute.java:808)
at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:445)
at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:459)
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:525)
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:566)
... 11 more
--- Nested Exception ---
java.io.IOException: CreateProcess: "perl c.pl" 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:566)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Exec
ute.java:808)
at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:445)
at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:459)
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:525)
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:566)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:415)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:301)
at org.apache.tools.ant.Target.performTasks(Target.java:328)
at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
at org.apache.tools.ant.Main.runBuild(Main.java:632)
at org.apache.tools.ant.Main.startAnt(Main.java:183)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
Total time: 1 second
What am I doing wrong?
Thanks,
Sheila