NotesOnAnt

From $1

Table of contents
  1. 1. Notes on Ant
      1. 1.1.1. Basic skeleton (build.xml):
      2. 1.1.2. Commands:
      3. 1.1.3. Custom Tasks:

Notes on Ant

Basic skeleton (build.xml):

<project name="projName" default="def-target" basedir="/base/path">
  <target name="targName" depends="a,b" if="prop-set" unless="prop-unset">
    <property name="propName" value="src" />
  </target>
</project>

Commands:

  • <deltree dir="dir" />

  • <mkdir dir="dir" />

  • <javac srcdir="${sourceDir}" destdir="${outputDir}" />

  • <taskdef name="customTask" classname="classFile" />

Custom Tasks:

  1. Create a Java class that extends org.apache.tools.ant.Task.
  2. For each attribute, write a "public void setAttributename" setter method that takes a single argument.
  3. If the task supports character data (text nested between the start end end tags), write a "public void addText(String)" method.
  4. Write a "public void execute()" that throws a BuildException.

Tags:
none
 
Images (0)
 
Comments (0)
You must login to post a comment.