You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Amar Rama <tr...@yahoo.com> on 2002/08/24 21:14:39 UTC

exec command deprecated since Ant 1.2 but recommended in Ant 1.5?

Hi,
    I am looking for some answers around the usage of the  <exec> 
command and would be grateful for any assistance :-).

According to the javadoc in the source code of the exec command 
(reproduced below), this command has been deprecated since Ant 1.2 and 
the use of the Execute command is suggested instead.

    The execute command though just extends java.lang.Object and not 
org.apache.tools.ant.Task. So, I am not sure I follow how I should use 
it in my build.xml (preliminary searches did not yield any results). I 
tried using the exec command and it works but I need to extend it to add 
minor custom functionality and I rather not extend a deprecated class.

    The FAQ on the home page for "How do I execute a batch file or shell 
script from ant?" 
(http://jakarta.apache.org/ant/faq.html#batch-shell-execute) still 
recommends using the <exec> command. Since this is the most recent FAQ, 
I am interpreting this as meaning, use the exec command for Ant 1.5. 
This seems slightly contradictory to the comment in the code.

    Can anybody suggest the right direction to take.


thanks for all the help in advance,
amar

___Javadoc from the exec source code____
/**
 * Executes a given command if the os platform is appropriate.
 *
 * <p><strong>As of Ant 1.2, this class is no longer the
 * implementation of Ant's &lt;exec&gt; task - it is considered to be
 * dead code by the Ant developers and is unmaintained.  Don't use
 * it.</strong></p>

 * @author duncan@x180.com
 * @author rubys@us.ibm.com
 *
 * @deprecated delegate to {@link org.apache.tools.ant.taskdefs.Execute 
Execute}
 *             instead.
 */



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


Re: exec command deprecated since Ant 1.2 but recommended in Ant 1.5?

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
Amar Rama wrote:
> Hi,
>    I am looking for some answers around the usage of the  <exec> command 
> and would be grateful for any assistance :-).

The <exec> task is not deprecated
The Exec class is deprecated
<exec> is no longer implemented by the Exec class but is now implemented by 
ExecTask

> 
> According to the javadoc in the source code of the exec command 
> (reproduced below), this command has been deprecated since Ant 1.2 and 
> the use of the Execute command is suggested instead.

True.

> 
>    The execute command though just extends java.lang.Object and not 
> org.apache.tools.ant.Task. 

Execute is not a task. It is "service" provided by Ant's core for tasks that 
wish to execute external commands. ExecTask is one such task.

> So, I am not sure I follow how I should use 
> it in my build.xml 

You don't.

> (preliminary searches did not yield any results). I 
> tried using the exec command and it works but I need to extend it to add 
> minor custom functionality and I rather not extend a deprecated class.

Look at ExecTask.


> 
>    The FAQ on the home page for "How do I execute a batch file or shell 
> script from ant?" 
> (http://jakarta.apache.org/ant/faq.html#batch-shell-execute) still 
> recommends using the <exec> command. 


This is correct.

> Since this is the most recent FAQ, 
> I am interpreting this as meaning, use the exec command for Ant 1.5. 
> This seems slightly contradictory to the comment in the code.
> 
>    Can anybody suggest the right direction to take.
> 

You have made an assumption (<exec> == Exec class) which is incorrect.

Conor



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


Re: exec command deprecated since Ant 1.2 but recommended in Ant 1.5?

Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
The Javadocs are not quite the place to go to learn about Ant tasks, at 
least not at an Ant "user" perspective.  Use the HTML task documentation 
for that.

But if you want to match up what class <exec> corresponds to, look at 
the embedded defaults.properties files in ant.jar 
(org/apache/tools/ant/taskdefs/defaults.properties) - this is how Ant 
constructs the objects used as built-in/optional tasks.

	Erik


Amar Rama wrote:
> Hi,
>    I am looking for some answers around the usage of the  <exec> command 
> and would be grateful for any assistance :-).
> 
> According to the javadoc in the source code of the exec command 
> (reproduced below), this command has been deprecated since Ant 1.2 and 
> the use of the Execute command is suggested instead.
> 
>    The execute command though just extends java.lang.Object and not 
> org.apache.tools.ant.Task. So, I am not sure I follow how I should use 
> it in my build.xml (preliminary searches did not yield any results). I 
> tried using the exec command and it works but I need to extend it to add 
> minor custom functionality and I rather not extend a deprecated class.
> 
>    The FAQ on the home page for "How do I execute a batch file or shell 
> script from ant?" 
> (http://jakarta.apache.org/ant/faq.html#batch-shell-execute) still 
> recommends using the <exec> command. Since this is the most recent FAQ, 
> I am interpreting this as meaning, use the exec command for Ant 1.5. 
> This seems slightly contradictory to the comment in the code.
> 
>    Can anybody suggest the right direction to take.
> 
> 
> thanks for all the help in advance,
> amar
> 
> ___Javadoc from the exec source code____
> /**
> * Executes a given command if the os platform is appropriate.
> *
> * <p><strong>As of Ant 1.2, this class is no longer the
> * implementation of Ant's &lt;exec&gt; task - it is considered to be
> * dead code by the Ant developers and is unmaintained.  Don't use
> * it.</strong></p>
> 
> * @author duncan@x180.com
> * @author rubys@us.ibm.com
> *
> * @deprecated delegate to {@link org.apache.tools.ant.taskdefs.Execute 
> Execute}
> *             instead.
> */
> 
> 
> 
> --
> 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>