Basic ANT build file Template

It happens all of the time, I want to write a new ANT build file, I don't really remember how to begin, so, I just copy a working build file and then I start removing most of its content.

Well, that's not so productive and is a bad practice in general, so for the benefit of all (me included), I've decided doing the same process for the last time, in order to create a basic Ant template file from which I will be able to begin each time.

This template contains only the most basic Ant build file.

Basic example which shows how to:

  • Create a basic Ant build file.
  • Usage of a property.
  • Usage of a Target (Method / Procedure).
  • Dependency of targets.
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="BasicTemplate" default="all">

<property name="distribution" value="${basedir}/dist" />

<target name="init" description="Some initialization acts which should run at the begining">
<mkdir dir="${distribution}"/>

<target name="clean" description="cleanup all of the temporary files and directories">
<delete dir="${distribution}"/>

<target name="all" depends="init, clean" description="Runs the two targets"/>


Popular posts from this blog

Profiling Java @ 2019

Ant Explorer graphical Ant build tool

Shared/Pro/Managed Hosting for your site - which to choose ? (NO AFFILIATE LINKS!)