JaVa
   

External Execution Tasks

External execution tasks enable you to invoke other programs and shell scripts.

Apply Task

The apply, exec, and execon tasks all have similar functions, but it is useful to review their capabilities before you decide which one to use. Apply is the most complex of the three. It executes the specified program using both file sets and mappers. The file sets define a group of files that will be applied to the executable. The mapper allows for time and date checking to compare the source files times against the destination files, avoiding unnecessary execution of unwanted sources. The apply task is as follows:

<apply executable="[command]" dest="[path]"/>


Parameters

Nested Parameters

Exec Task

As we mentioned earlier, the apply, exec, and execon tasks have similar functions. Exec is the simplest of the three—it simply executes the specified program:

<exec executable="[commad and switches]"/>


Parameters

Nested Parameters

Execon Task

As we’ve mentioned, the apply, exec, and execon tasks have similar functions. Execon’s complexity falls between the other two. It executes the specified program and allows for filesets to be used. The filesets define a group of files that can be applied to the executable:

<execon executable="[command]">
 <fileset dir="[directory]" includes="[pateren set]"/>
</apply>


Parameters

Nested Parameters

Java Task

The java task executes a Java class:

<java classname="java class" />


This method of invoking the compiler has many useful options you can use to invoke a new JVM for the Java app to run in. In most cases, it is more robust to invoke a new JVM.

Parameters

Nested Parameters

Javac Task

This command is used to compile Java source code using the JVM in which Ant is running:

<javac srcdir="[directory]"/>


Parameters

Nested Parameters

Sql Task

The sql task executes SQL statements using a JBDC source:

<sql
 driver="[java class]"
 url="[database url]"
 userid="[user]"
 password="[password]"
 src="[file]"
/>


Commands can be executed without an src parameter file, as follows:

<sql
 driver=[java class]
 url="[database url]"
 userid="[user]"
 password="[password]"
 >
select *
from tablefoo insert into table foo values (1,2,3)
</sql>


Parameters

Nested Parameters


JaVa
   
Comments