ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Weintraub" <qazw...@gmail.com>
Subject Re: Exec task: Args not passed to task
Date Mon, 28 Apr 2008 19:28:12 GMT
What if you used the <arg value="xx"/> instead of <arg line="xx xx xx"/>?

That is:

<exec executable="chmod"
    timeout="${timeout}"
    failonerror="true">
   <arg value="-R"
   <arg value="${dirMask}"
    <arg value="${path}"/>
</exec>

On Mon, Apr 28, 2008 at 3:20 AM, Xavi <ettikx@gmail.com> wrote:
> Hi, I'm migrating an app from Ant 1.6.1 to Ant 1.7.0, and I have problems
>  with exec tasks. Ant execute task without passing arguments to process!
>
>  For example, I have this task definition:
>
>  <project name="permision" default="permision"  basedir=".">
>
>         <property name="timeout" value="120000" />
>
>         <target name="permision">
>
>                 <echo message="Modify directories permissions ${path}, mask
>  ${dirMask}" />
>
>                 <exec executable="chmod"
>                           timeout="${timeout}"
>                           failonerror="true">
>
>                         <arg line="-R ${dirMask} ${path}" />
>
>                 </exec>
>
>                 <echo message="Modify files permissions ${path}, mask
>  ${fileMask}" />
>
>                 <exec executable="/data/bin/ant/permisions.sh"
>                           timeout="${timeout}"
>                           failonerror="true">
>
>                         <arg line="${path} ${fileMask}" />
>
>                 </exec>
>
>         </target>
>
>  </project>
>
>  An easy one, and works ok with Ant 1.6, as you can see in logs:
>
>  (...)
>  23 Apr 2008 17:31:10 [INFO ] Modify directories permissions
>  /data/servers/ftp, mask 755
>  23 Apr 2008 17:31:10 [DEBUG] Task "echo"finished
>  23 Apr 2008 17:31:10 [DEBUG] Task "exec" started
>  23 Apr 2008 17:31:10 [DEBUG] Current OS is AIX
>  23 Apr 2008 17:31:10 [DEBUG] Executing 'chmod' with arguments:
>  '-R'
>  '755'
>  '/data/servers/ftp'
>
>  The ' characters around the executable and arguments are
>  not part of the command.
>  23 Apr 2008 17:31:10 [DEBUG] Execute:Java13CommandLauncher: Executing
>  'chmod' with arguments:
>  '-R'
>  '755'
>  '/data/servers/ftp
>
>  The ' characters around the executable and arguments are
>  not part of the command.
>  23 Apr 2008 17:31:10 [INFO ]
>  (...)
>
>
>  With Ant 1.7.0 I get this log:
>
>  24 Apr 2008 15:49:42 [DEBUG] Task "echo" started
>  24 Apr 2008 15:49:42 [INFO ] Modify directories permissions
>  /data/servers/ftp, mask 777
>  24 Apr 2008 15:49:42 [DEBUG] Task "echo"finished
>  24 Apr 2008 15:49:42 [DEBUG] Task "exec" started
>  24 Apr 2008 15:49:42 [DEBUG] Current OS is AIX
>  24 Apr 2008 15:49:42 [DEBUG] Executing 'chmod'
>  The ' characters around the executable and arguments are
>  not part of the command.
>  24 Apr 2008 15:49:42 [DEBUG] Execute:Java13CommandLauncher: Executing
>  'chmod'
>  The ' characters around the executable and arguments are
>  not part of the command.
>  24 Apr 2008 15:49:42 [INFO ] Usage: chmod [-R] [-f] [-h] {u|g|o|a ...}
>  {+|-|=} {r|w|x|X|s|t ...} File ...
>  24 Apr 2008 15:49:42 [INFO ]  chmod [-R] [-f] [-h] OctalNumber File ...
>  24 Apr 2008 15:49:42 [INFO ]  Changes the permission codes for files or
>  directories.
>  24 Apr 2008 15:49:42 [ERROR] Task "exec" finished with error (null)
>  24 Apr 2008 15:49:42 [ERROR] Target "permision" finished with error (null)
>  /data/bin/ant/permisions.xml:8: exec returned: 255
>    at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:636)
>    at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:662)
>    at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:487)
>    at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
>    at
>  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>    at java.lang.reflect.Method.invoke(Method.java:618)
>    at
>  org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>    at org.apache.tools.ant.Task.perform(Task.java:348)
>    at org.apache.tools.ant.Target.execute(Target.java:357)
>    at org.apache.tools.ant.Target.performTasks(Target.java:385)
>    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
>    at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
>    at
>  org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
>    at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
>    at com.sbd.hardist.util.ant.AntProcess.execute(AntProcess.java:157)
>
>  Ant task isn't receiving parameters!
>
>  This task are executed using Ant's java api. If I execute task manually, all
>  goes ok too. And if I use deprecated <exec command, all goes fine too!
>
>  Someone have an idea what's happening here? Thanks in advance!
>



-- 
--
David Weintraub
qazwart@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message