Using ant
The ant utility is a new and better alternative to using make. Ant ist
specifically designed to work with Java, and it also offers some predefined tasks like
- compiling
- file moving, copying, deleting
- executing other processes
and many more.
This is a part of a build.xml file for ant.
<project name="Sample agents" default="agents">
<property name="src" value="${basedir}/src" />
<property name="build" value="${basedir}/build" />
<property name="spu" value="${basedir}/spu" />
...
<target name="agents" depends="init,misc,base" description="Build sample agents">
<javac deprecation="${deprecation}"
srcdir="${src}"
destdir="${build}"
debug="on"
includes="samples/agents/*.java samples/utils/*.java">
<classpath path="${ametascp}:${log4jcp}:${jdom}" />
</javac>
</target>
<target name="clean">
<delete dir="${build}" />
<delete dir="${spu}" />
</target>
</project>
|
But ant is also capable of running other processes, especially launching Java
applications. This means that we can also use ant and its build.xml
file to create the SPUs:
<property name="ContBuild" value="AMETAS.sdk.ContainerBuilder" />
<property name="Agent" value="samples.agents.SampleAgent" />
<target name="samplespu" description="Building Sample agent SPU"
depends="agents">
<java classname="${ContBuild}" fork="true" classpath="${spucp}">
<arg line="crspu ${Agent} -src ${build} -dst ${spu} -force"/>
</java>
<java classname="${ContBuild}" fork="true" classpath="${spucp}">
<arg line="addtype ${spu}/${Agent} -str SampleAgent"/>
</java>
<java classname="${ContBuild}" fork="true" classpath="${spucp}">
<arg line="addsig ${spu}/${Agent} -privk ${basedir}/admin.idy"/>
</java>
</target>
|
Finally, you can also create your Javadoc documentation:
<target name="alldoc" depends="init" description="Build documentation">
<javadoc sourcepath="${src}" destdir="${docs}"
packagenames="Samples.agents.*"
version="true" use="true" author="true" access="package"
windowtitle="Sample Agents documentation"
Doctitle="Sample Agents documentation"
Overview="${src}/overview.html">
<classpath path="${ametascp}"/>
<link href="http://www.accsis.com/ametas/docs/apipub/" />
<link href="http://java.sun.com/j2se/1.3/docs/api/" />
</javadoc>
</target>
|
We cannot provide a comprehensive introduction to ant at this point. But you
can and should consult the online documentation at the Ant documentation on the Jakarta webpages.