Ant build.xml files

Submitted by code_admin on Tue, 07/17/2018 - 13:46

This page holds my notes on ant scripts

Known Task Example
antcall
ant
echo
mkdir
get dest="${servlet24.jar}"
verbose="true"/>
copy
delete
jar
input
email tolist="antUser01@example.com,antUser02@example.com"
mailhost="${mail.mailhost}"
user="${mail.user}"
password="${mail.password}"
subject="${mail.subject}">

${mail.message.docs}




sql
  1. database.root=jdbc:mysql://localhost:3306/
  2. driver.name=com.mysql.jdbc.Driver
  3.  
  4. drop.sql=SQL/drop.sql
  5. create.sql=SQL/create.sql
  6. insert.sql=SQL/insert.sql

url="${database.root}"
userid="${database.user}"
password="${database.password}">

sleep
xslt out="${test.checkstyle.reports}/checkstyle_report.html"
style="${checkstyle.home}/contrib/checkstyle-noframes-sorted.xsl"/>
replaceregexp replace="https://${@{target-server}.server.soaserverhostname}:${@{target-server}.server.soaserverport}/\1/"
byline="true" flags="gi">
includes="**/*composite.xml **/*.wsdl **/*.xsl **/*.xslt **/*.xsd **/*.componentType **/*.xml"
excludes="**/.ade_path/**"/>
fail





antfetch*

tstamp

*From contrib module

Condition Tasks

See http://ant.apache.org/manual/Tasks/conditions.html for core condition tasks

Task Name Example Description
available Sets property if directory is present. You can also use type="file"
tmpfile prefix="AIDExtractxsl_temp_" suffix=".xsl" />
concat see: http://ant.apache.org/manual/Tasks/concat.html

Classpath Example


<property file="build.properties"/>
<!-- This code builds the class path -->
<path id="build.classpath">
  <pathelement location="${servlet24.jar}"/>
  <pathelement location="${jsp20.jar}"/>
  <pathelement location="${mysql.jar}"/>
  <pathelement path="${appName.jar}"/>
</path>

<target name="rjm" description="RJM Dummy task for stuff">
    <echo message="RJM Dummy Start"/>
    <echo message="Classpath: ${toString:build.classpath}"/>
    <echo message="RJM Dummy End"/>
</target>

Properties

Run this example with the command - ant -Drjm.test.prop="OVE R"

<macrodef name="propertycopy">
  <attribute name="name"/>
  <attribute name="from"/>
  <sequential>
    <property name="@{name}" value="${@{from}}"/>
  </sequential>
</macrodef>








<propertycopy name="prop.res" from="${p.pointer}"/>

<echo message="pointer*: ${prop.res}"/>






<echo message="ANT_HOME: ${env.ANT_HOME}"/>
<echo message="OS: ${env.OS}"/>
<echo message="Processor: ${env.PROCESSOR_ARCHITECTURE}"/>





RJM Article Type
Quick Reference