ANT File List

In the previous tutorial we have learnt about the File Set and different pattern sets available in Apache Ant. In this tutorial we will be learning the difference between file list and file set. ANT File List :File list data type in ant is used for creating list of files. File list contains the list of files explicitly having the name of the file. Unlike File Set, File List does not support the wild card characters. File list data type can be applied [...]

ANT Pattern Set

Pattern Set Suppose we need to filter the files or folders based on certain pattern then we can use Ant Pattern Set. Some meta characters are used for the creating patterns -Consider the example of the following pattern -<patternset id="java.files.without.order"> <include name="src/**/*.java"/> <exclude name="src/**/*order*"/> </patternset>The if we need to reuse the patternset then we can reuse it as below -<fileset dir="${src}" casesensitive="yes"> <patternset refid="java.files.without.order"/> </fileset>

ANT File Set

Ant File Set :The Fileset refer as a collection of files. The Fileset is generally used as a filter to include and exclude files that match a particular pattern.Sample Example:<fileset dir="${src}" casesensitive="yes"> <include name="**/*.java"/> <exclude name="**/*Order*"/> </fileset>Explanation of Build Script :The src attribute written in fileset element points to the source folder of the project. The fileset selects all java files in the source folder but all the java files containing the word 'Order' will be excluded The filter applied to [...]

ANT Property Files

Using ANT property file : First question in our mind is that why we really need to use the property file if we already have a way to define and declare the properties in the build file -Suppose we are working on complex project which has descent number of properties then it is recommended to use separate property file Suppose we need to keep build file same on all environments such as DEV,PROD or Testing then we can use separate property [...]

ANT Property Task

Using pre-defined properties : Below are some pre-defined properties that can be used in the build file directlyPropertiesDescription ant.fileFull location of the build file. ant.versionVersion of the Apache Ant installation. basedirThe basedir of the build, as specified in the basedir attribute of the project element. ant.java.versionThe version of the JDK that is used by Ant. ant.project.nameThe name of the project, as specified in the name atrribute of the project element ant.project.default-targetThe default target of the current project ant.project.invoked-targetsComma separated list of the targets that were invoked in [...]

ANT Build Files

Sample Build File :<?xml version="1.0"?> <project name="Hello World" default="info"> <target name="info"> <echo>Hello World - Welcome to Apache Ant!</echo> </target> </project>Output : Open command prompt and navigate to the folder where we have put build.xml and type ant [target name] We have specified default target name that's why we can simply use ant command for building project. See below steps - C:\>ant Buildfile: C:\build.xmlinfo: [echo] Hello World - Welcome to Apache Ant!BUILD SUCCESSFUL Total time: 0 seconds The echo task [...]

ANT Environment Setup

Installing Prerequisite : Before installing ANT we must check our system, if JDK installation is already present in your local system or not. If JDK is installed then check whether the Class path entry for jdk is present or not. If not, please follow the instructions here. Installing Eclipse We need Eclipse IDE for learning the integration between Ant and Java. Follow below directions to download and install the Eclipse IDE. Installing Eclipse :Download the latest Eclipse Binaries from www.eclipse.org Unzip the Eclipse binaries to [...]

ANT Introduction

Need of build tool : We know that while doing complex coding practices in the Java we sometimes do following time consuming and hectic tasks manually, such as -Compiling the Java code Packaging the binaries Deploying the binaries to the server Testing out the changes Moving or copying code from one location to anotherIf you really want to make your task more simpler by automating all these processes then we need to use the build tools.The above chart indicate that -On average, a [...]