You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by David McTavish <dm...@SANDVINE.com> on 2002/11/19 20:37:51 UTC

ant exec task

Hi everybody,

Seems like I'm running into an unexplainable brick wall that maybe someone
out here as seen before... I've been hitting my head against this for the
past two hours :(
Basically, I'm running antv1.5.1 on JDK 1.3 (ugh, I know), and am having a
problem with the exec task.
When I run the target from the build script that it exists in, I have no
problem whatsoever. My problem is when I try to roll this up into the parent
level build script I get an error.

Error I get:
BUILD FAILED
file:M:/dmctavish_main/sw-profserv/scripts/bundle.xml:110: Execute failed:
java.
io.IOException: CreateProcess: ..\..\sw-tools\nsis\makensis.exe /V1 golden
error=2


Basically, I have a parent level build.xml file with a target
"bundle.golden". This target calls the "bundle" target in the build.xml file
that is found in the golden directory. Nothing special going on in my
mind... here's the parent-level target:

    <target name="bundle.golden">
        <ant dir="golden" target="bundle" inheritall="false"/>
    </target>

In my golden directory, I have a build.xml with the following target:

    <property name="bin.nsis" value="../../tools/nsis/makensis.exe"/>
    <property name="deploy.product.dir" value="../products/golden"/>

    <target name="bundle">
        <exec executable="${bin.nsis}" dir="${deploy.product.dir}">
            <arg line="/V1 golden" />
        </exec>
    </target>

I've surrounded the exec task with <available> tasks to guarantee that the
executable is found, as well as the deploy.product.dir is correct. These
return true whether I call this "bundle" target from the local folder or the
parent.
ie:
<available property="test" file="${bin.nsis}"/>
<available property="test2" file="${deploy.product.dir}/golden.nsi"/>
<echo message="${test}${test2}"/>

debug message reveals the following:
--- Nested Exception ---
java.io.IOException: CreateProcess: ..\..\sw-tools\nsis\makensis.exe /V1
golden
error=2
        at java.lang.Win32Process.create(Native Method)
        at java.lang.Win32Process.<init>(Win32Process.java:61)
        at java.lang.Runtime.execInternal(Native Method)
        at java.lang.Runtime.exec(Runtime.java:546)
        at java.lang.reflect.Method.invoke(Native Method)
        at
org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Exec
ute.java:645)
        at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:417)
        at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:428)
        at
org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:329)
        at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:368)
        at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:250)
        at org.apache.tools.ant.Task.perform(Task.java:317)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at org.apache.tools.ant.Target.performTasks(Target.java:334)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:371)
        at
org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:143)

any ideas would be greatly appreciated!

regards,
d.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: ant exec task

Posted by Stefan Bodewig <bo...@apache.org>.
On Tue, 19 Nov 2002, David McTavish <dm...@sandvine.com> wrote:

> java.  io.IOException: CreateProcess:
> ..\..\sw-tools\nsis\makensis.exe /V1 golden error=2

Apart from what Dominique said:  When running on JDK 1.3+, Ant will by
default use the JDK's built-in method of invoking an executable in a
different working directory - this one is known to have problems with
executables that are given with a relative path.

Does setting <exec>'s vmlauncher attribute to false fix the problem?

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>