Invoking from Ant | ![]() print-friendly |
by Ovidiu Predescu, Jeff Turner
Invoking from Ant
Often, people want to integrate Anteater with an existing Ant-based build system. Due to classpath issues, Anteater tasks cannot currently be used directly within an existing Ant script. The current solution is to invoke Anteater with a <java> task, as follows:
<property name="anteater.home" location="/usr/local/anteater"/>
<java classname="org.apache.tools.ant.Main" fork="true">
<classpath>
<pathelement location="${anteater.home}/resources"/>
<fileset dir="${anteater.home}">
<include name="lib/**/*.jar"/>
<include name="tomcat/**/*.jar"/>
</fileset>
</classpath>
<jvmarg value="-Dant.home=${anteater.home}"/>
<jvmarg value="-Danteater.home=${anteater.home}" />
<jvmarg value="-Danteater.report=${anteater.home}/resources/scripts/report.xml" />
<jvmarg value="-Danteater.resources=${anteater.home}/resources" />
<arg line="-f examples.xml"/>
<arg value="-propertyfile" />
<arg value="${anteater.home}/resources/META-INF/Anteater.properties" />
<!--
<arg value="-Ddefault.debug=10"/>
-->
</java>
The anteater.home variable must be set to where you have installed Anteater. Replace examples.xml with your script. Alternatively, you can parametrize this:
<antcall target="anteater"> <param name="script" value="examples.xml"/> </antcall>
with this target:
<target name="anteater" description="Run Anteater">
<property name="anteater.home" location="build/anteater-${version}"/>
<java classname="org.apache.tools.ant.Main"
fork="true">
<classpath>
<fileset dir="${anteater.home}">
<include name="lib/**/*.jar"/>
<include name="tomcat/**/*.jar"/>
</fileset>
</classpath>
<jvmarg value="-Dant.home=${anteater.home}"/>
<arg line="-f ${script}"/>
<!--
<arg value="-Ddefault.debug=10"/>
-->
</java>
</target>

