Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to call ant task from a javascript scriptdef task?

Tags:

ant

Is it possible to call an ant task that is in the same ant script from a javascript scripdef task?

like image 759
rohitsan Avatar asked Sep 26 '12 18:09

rohitsan


1 Answers

Yes. In case you meant target, rather than a task, here are examples of both:

<target name="test">
    <echo message="In test target" />
</target>

<scriptdef name="demo" language="javascript">
<![CDATA[
    self.project.executeTarget( "test" );

    var task = project.createTask( "echo" );
    task.setMessage( "In demo task" );
    task.perform( );
]]>
</scriptdef>

<demo />    

When run, yields:

test:
     [echo] In test target
     [echo] In demo task

It may be useful to refer to the Ant API and docs for the script task.

like image 145
martin clayton Avatar answered Sep 20 '22 09:09

martin clayton