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 21:14:34 UTC

possible bug in ExecTask.java? was RE: ant exec task

It seems that if you use the <ant> task to execute a target in an external
build file that is in a different directory than the the build file in which
you initiated, the relative path for the exec command does not get updated,
but it does update for other tasks such as echo and available.

has anybody encountered thsi before?


-----Original Message-----
From: David McTavish [mailto:dmctavish@SANDVINE.com] 
Sent: Tuesday, November 19, 2002 2:38 PM
To: 'Ant Users List'
Subject: 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>

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