This document provides an overview of the Apache Ant build tool. It describes what Ant is used for, how to install and configure it, the basic structure of Ant build files written in XML, and how to define properties, targets, tasks and other elements. It also provides an example of an Ant build file that would compile Java source code and place the class files in the proper directory for a sample web application project structure.
Ant is a Java library and command-line tool. Ant's mission is to drive processes described in build files as targets and extension points dependent upon each other. The main known usage of Ant is the build of Java applications. Ant supplies a number of built-in tasks allowing to compile, assemble, test and run Java applications. Ant can also be used effectively to build non Java applications, for instance C or C++ applications. More generally, Ant can be used to pilot any type of process which can be described in terms of targets and tasks.
Ant is written in Java. Users of Ant can develop their own "antlibs" containing Ant tasks and types, and are offered a large number of ready-made commercial or open-source "antlibs".
Ant is extremely flexible and does not impose coding conventions or directory layouts to the Java projects which adopt it as a build tool.
Software development projects looking for a solution combining build tool and dependency management can use Ant in combination with Ivy.
Ant is a Java library and command-line tool. Ant's mission is to drive processes described in build files as targets and extension points dependent upon each other. The main known usage of Ant is the build of Java applications. Ant supplies a number of built-in tasks allowing to compile, assemble, test and run Java applications. Ant can also be used effectively to build non Java applications, for instance C or C++ applications. More generally, Ant can be used to pilot any type of process which can be described in terms of targets and tasks.
Ant is written in Java. Users of Ant can develop their own "antlibs" containing Ant tasks and types, and are offered a large number of ready-made commercial or open-source "antlibs".
Ant is extremely flexible and does not impose coding conventions or directory layouts to the Java projects which adopt it as a build tool.
Software development projects looking for a solution combining build tool and dependency management can use Ant in combination with Ivy.
Ant is a Java library and command-line tool. Ant's mission is to drive processes described in build files as targets and extension points dependent upon each other. The main known usage of Ant is the build of Java applications. Ant supplies a number of built-in tasks allowing to compile, assemble, test and run Java applications. Ant can also be used effectively to build non Java applications, for instance C or C++ applications. More generally, Ant can be used to pilot any type of process which can be described in terms of targets and tasks.
Ant is written in Java. Users of Ant can develop their own "antlibs" containing Ant tasks and types, and are offered a large number of ready-made commercial or open-source "antlibs".
Ant is extremely flexible and does not impose coding conventions or directory layouts to the Java projects which adopt it as a build tool.
Software development projects looking for a solution combining build tool and dependency management can use Ant in combination with Ivy.
This is an adaptation of the presentation given at the SpringOne 2008 conference in Hollywood, FL. It contains some updates on project status, and also information about the recently published book "Spring Python 1.1"
This slideshow is licensed under a Creative Commons Attribution 3.0 United States License.
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry PiJérémy Derussé
Le moyen le plus rapide d'obtenir une réponse d'un Backend est de ne pas l'appeler ;-) Une solution fournie par les "reverse-proxy" me direz-vous, mais pas si simple d'invalider le cache...
Ce talk aborde une fonctionnalité méconnue de Varnish: les tags. Nous verrons comment en tirer partie via les "event listeners" d'une application Symfony standard. Au menu, un cluster de Rasberry Pi, une API, et des données toujours fraîches sous la milliseconde.
A book for learning puppet by real example and by building code. Chapter 1 gives you basic introduction and sets you up with a server-agent using Vagrant so that you can do hands-on.
Using Rails to Create an Enterprise App: A Real-Life Case StudyDavid Keener
Rails is a great framework for quickly creating "green field" web applications. Find out how well it works when creating internal, corporate web applications that have to access multiple legacy databases.
Play Framework makes it easy to build web applications with Java & Scala. This presentation give a idea of how play is implemented using Netty, how routes work. How we get calls in controller's action. Walk through guice and logging.
Ant is a Java library and command-line tool. Ant's mission is to drive processes described in build files as targets and extension points dependent upon each other. The main known usage of Ant is the build of Java applications. Ant supplies a number of built-in tasks allowing to compile, assemble, test and run Java applications. Ant can also be used effectively to build non Java applications, for instance C or C++ applications. More generally, Ant can be used to pilot any type of process which can be described in terms of targets and tasks.
Ant is written in Java. Users of Ant can develop their own "antlibs" containing Ant tasks and types, and are offered a large number of ready-made commercial or open-source "antlibs".
Ant is extremely flexible and does not impose coding conventions or directory layouts to the Java projects which adopt it as a build tool.
Software development projects looking for a solution combining build tool and dependency management can use Ant in combination with Ivy.
scmGalaxy.com is dedicated to software configuration, build and Release management. This covers CVS, VSS (Visual Source Safe),Perforce, SVN(Subversion) MKS Integrity, ClearCase,TFS,CM Synergy, Best Practices ,AnthillPro, Apache Ant, Maven, Bamboo, Cruise Control and many more tools.
File Can be downloaded from:
http://community.scmgalaxy.com/
Ant is a Java library and command-line tool. Ant's mission is to drive processes described in build files as targets and extension points dependent upon each other. The main known usage of Ant is the build of Java applications. Ant supplies a number of built-in tasks allowing to compile, assemble, test and run Java applications. Ant can also be used effectively to build non Java applications, for instance C or C++ applications. More generally, Ant can be used to pilot any type of process which can be described in terms of targets and tasks.
Ant is written in Java. Users of Ant can develop their own "antlibs" containing Ant tasks and types, and are offered a large number of ready-made commercial or open-source "antlibs".
Ant is extremely flexible and does not impose coding conventions or directory layouts to the Java projects which adopt it as a build tool.
Software development projects looking for a solution combining build tool and dependency management can use Ant in combination with Ivy.
This is an adaptation of the presentation given at the SpringOne 2008 conference in Hollywood, FL. It contains some updates on project status, and also information about the recently published book "Spring Python 1.1"
This slideshow is licensed under a Creative Commons Attribution 3.0 United States License.
Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry PiJérémy Derussé
Le moyen le plus rapide d'obtenir une réponse d'un Backend est de ne pas l'appeler ;-) Une solution fournie par les "reverse-proxy" me direz-vous, mais pas si simple d'invalider le cache...
Ce talk aborde une fonctionnalité méconnue de Varnish: les tags. Nous verrons comment en tirer partie via les "event listeners" d'une application Symfony standard. Au menu, un cluster de Rasberry Pi, une API, et des données toujours fraîches sous la milliseconde.
A book for learning puppet by real example and by building code. Chapter 1 gives you basic introduction and sets you up with a server-agent using Vagrant so that you can do hands-on.
Using Rails to Create an Enterprise App: A Real-Life Case StudyDavid Keener
Rails is a great framework for quickly creating "green field" web applications. Find out how well it works when creating internal, corporate web applications that have to access multiple legacy databases.
Play Framework makes it easy to build web applications with Java & Scala. This presentation give a idea of how play is implemented using Netty, how routes work. How we get calls in controller's action. Walk through guice and logging.
Ant is a Java library and command-line tool. Ant's mission is to drive processes described in build files as targets and extension points dependent upon each other. The main known usage of Ant is the build of Java applications. Ant supplies a number of built-in tasks allowing to compile, assemble, test and run Java applications. Ant can also be used effectively to build non Java applications, for instance C or C++ applications. More generally, Ant can be used to pilot any type of process which can be described in terms of targets and tasks.
Ant is written in Java. Users of Ant can develop their own "antlibs" containing Ant tasks and types, and are offered a large number of ready-made commercial or open-source "antlibs".
Ant is extremely flexible and does not impose coding conventions or directory layouts to the Java projects which adopt it as a build tool.
Software development projects looking for a solution combining build tool and dependency management can use Ant in combination with Ivy.
scmGalaxy.com is dedicated to software configuration, build and Release management. This covers CVS, VSS (Visual Source Safe),Perforce, SVN(Subversion) MKS Integrity, ClearCase,TFS,CM Synergy, Best Practices ,AnthillPro, Apache Ant, Maven, Bamboo, Cruise Control and many more tools.
File Can be downloaded from:
http://community.scmgalaxy.com/
Ant Migration tool is used to Create and Fetch Metadata to and from an organisation. It’s a command-line utility by which one can upload and download Metadata components.
Maven: Managing Software Projects for Repeatable ResultsSteve Keener
This presentation explores the features of Maven 2, a software build tool that has achieved prominence in the Java development arena. Find out how Maven can be leveraged to automate key project tasks.
The Apache Felix Web Console has been created out of a need to remotely administer an OSGi Framework. This administration includes maintenance of bundles, editing Configuration, and introspecting the system in terms of identifying services and Declarative Services components. In addition the Web Console offers a plugin-model for it to be easily extended.
Lightning web components are custom HTML elements built using HTML and modern JavaScript. Lightning Web Components uses core Web Components standards and provides only what’s necessary to perform well in browsers supported by Salesforce.
Overview of the fundamental roles in Hydropower generation and the components involved in wider Electrical Engineering.
This paper presents the design and construction of hydroelectric dams from the hydrologist’s survey of the valley before construction, all aspects and involved disciplines, fluid dynamics, structural engineering, generation and mains frequency regulation to the very transmission of power through the network in the United Kingdom.
Author: Robbie Edward Sayers
Collaborators and co editors: Charlie Sims and Connor Healey.
(C) 2024 Robbie E. Sayers
About
Indigenized remote control interface card suitable for MAFI system CCR equipment. Compatible for IDM8000 CCR. Backplane mounted serial and TCP/Ethernet communication module for CCR remote access. IDM 8000 CCR remote control on serial and TCP protocol.
• Remote control: Parallel or serial interface.
• Compatible with MAFI CCR system.
• Compatible with IDM8000 CCR.
• Compatible with Backplane mount serial communication.
• Compatible with commercial and Defence aviation CCR system.
• Remote control system for accessing CCR and allied system over serial or TCP.
• Indigenized local Support/presence in India.
• Easy in configuration using DIP switches.
Technical Specifications
Indigenized remote control interface card suitable for MAFI system CCR equipment. Compatible for IDM8000 CCR. Backplane mounted serial and TCP/Ethernet communication module for CCR remote access. IDM 8000 CCR remote control on serial and TCP protocol.
Key Features
Indigenized remote control interface card suitable for MAFI system CCR equipment. Compatible for IDM8000 CCR. Backplane mounted serial and TCP/Ethernet communication module for CCR remote access. IDM 8000 CCR remote control on serial and TCP protocol.
• Remote control: Parallel or serial interface
• Compatible with MAFI CCR system
• Copatiable with IDM8000 CCR
• Compatible with Backplane mount serial communication.
• Compatible with commercial and Defence aviation CCR system.
• Remote control system for accessing CCR and allied system over serial or TCP.
• Indigenized local Support/presence in India.
Application
• Remote control: Parallel or serial interface.
• Compatible with MAFI CCR system.
• Compatible with IDM8000 CCR.
• Compatible with Backplane mount serial communication.
• Compatible with commercial and Defence aviation CCR system.
• Remote control system for accessing CCR and allied system over serial or TCP.
• Indigenized local Support/presence in India.
• Easy in configuration using DIP switches.
Immunizing Image Classifiers Against Localized Adversary Attacksgerogepatton
This paper addresses the vulnerability of deep learning models, particularly convolutional neural networks
(CNN)s, to adversarial attacks and presents a proactive training technique designed to counter them. We
introduce a novel volumization algorithm, which transforms 2D images into 3D volumetric representations.
When combined with 3D convolution and deep curriculum learning optimization (CLO), itsignificantly improves
the immunity of models against localized universal attacks by up to 40%. We evaluate our proposed approach
using contemporary CNN architectures and the modified Canadian Institute for Advanced Research (CIFAR-10
and CIFAR-100) and ImageNet Large Scale Visual Recognition Challenge (ILSVRC12) datasets, showcasing
accuracy improvements over previous techniques. The results indicate that the combination of the volumetric
input and curriculum learning holds significant promise for mitigating adversarial attacks without necessitating
adversary training.
Automobile Management System Project Report.pdfKamal Acharya
The proposed project is developed to manage the automobile in the automobile dealer company. The main module in this project is login, automobile management, customer management, sales, complaints and reports. The first module is the login. The automobile showroom owner should login to the project for usage. The username and password are verified and if it is correct, next form opens. If the username and password are not correct, it shows the error message.
When a customer search for a automobile, if the automobile is available, they will be taken to a page that shows the details of the automobile including automobile name, automobile ID, quantity, price etc. “Automobile Management System” is useful for maintaining automobiles, customers effectively and hence helps for establishing good relation between customer and automobile organization. It contains various customized modules for effectively maintaining automobiles and stock information accurately and safely.
When the automobile is sold to the customer, stock will be reduced automatically. When a new purchase is made, stock will be increased automatically. While selecting automobiles for sale, the proposed software will automatically check for total number of available stock of that particular item, if the total stock of that particular item is less than 5, software will notify the user to purchase the particular item.
Also when the user tries to sale items which are not in stock, the system will prompt the user that the stock is not enough. Customers of this system can search for a automobile; can purchase a automobile easily by selecting fast. On the other hand the stock of automobiles can be maintained perfectly by the automobile shop manager overcoming the drawbacks of existing system.
Explore the innovative world of trenchless pipe repair with our comprehensive guide, "The Benefits and Techniques of Trenchless Pipe Repair." This document delves into the modern methods of repairing underground pipes without the need for extensive excavation, highlighting the numerous advantages and the latest techniques used in the industry.
Learn about the cost savings, reduced environmental impact, and minimal disruption associated with trenchless technology. Discover detailed explanations of popular techniques such as pipe bursting, cured-in-place pipe (CIPP) lining, and directional drilling. Understand how these methods can be applied to various types of infrastructure, from residential plumbing to large-scale municipal systems.
Ideal for homeowners, contractors, engineers, and anyone interested in modern plumbing solutions, this guide provides valuable insights into why trenchless pipe repair is becoming the preferred choice for pipe rehabilitation. Stay informed about the latest advancements and best practices in the field.
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSEDuvanRamosGarzon1
AIRCRAFT GENERAL
The Single Aisle is the most advanced family aircraft in service today, with fly-by-wire flight controls.
The A318, A319, A320 and A321 are twin-engine subsonic medium range aircraft.
The family offers a choice of engines
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...Amil Baba Dawood bangali
Contact with Dawood Bhai Just call on +92322-6382012 and we'll help you. We'll solve all your problems within 12 to 24 hours and with 101% guarantee and with astrology systematic. If you want to take any personal or professional advice then also you can call us on +92322-6382012 , ONLINE LOVE PROBLEM & Other all types of Daily Life Problem's.Then CALL or WHATSAPP us on +92322-6382012 and Get all these problems solutions here by Amil Baba DAWOOD BANGALI
#vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore#blackmagicformarriage #aamilbaba #kalajadu #kalailam #taweez #wazifaexpert #jadumantar #vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore #blackmagicforlove #blackmagicformarriage #aamilbaba #kalajadu #kalailam #taweez #wazifaexpert #jadumantar #vashikaranspecialist #astrologer #palmistry #amliyaat #taweez #manpasandshadi #horoscope #spiritual #lovelife #lovespell #marriagespell#aamilbabainpakistan #amilbabainkarachi #powerfullblackmagicspell #kalajadumantarspecialist #realamilbaba #AmilbabainPakistan #astrologerincanada #astrologerindubai #lovespellsmaster #kalajaduspecialist #lovespellsthatwork #aamilbabainlahore #Amilbabainuk #amilbabainspain #amilbabaindubai #Amilbabainnorway #amilbabainkrachi #amilbabainlahore #amilbabaingujranwalan #amilbabainislamabad
Event Management System Vb Net Project Report.pdfKamal Acharya
In present era, the scopes of information technology growing with a very fast .We do not see any are untouched from this industry. The scope of information technology has become wider includes: Business and industry. Household Business, Communication, Education, Entertainment, Science, Medicine, Engineering, Distance Learning, Weather Forecasting. Carrier Searching and so on.
My project named “Event Management System” is software that store and maintained all events coordinated in college. It also helpful to print related reports. My project will help to record the events coordinated by faculties with their Name, Event subject, date & details in an efficient & effective ways.
In my system we have to make a system by which a user can record all events coordinated by a particular faculty. In our proposed system some more featured are added which differs it from the existing system such as security.
Saudi Arabia stands as a titan in the global energy landscape, renowned for its abundant oil and gas resources. It's the largest exporter of petroleum and holds some of the world's most significant reserves. Let's delve into the top 10 oil and gas projects shaping Saudi Arabia's energy future in 2024.
Water scarcity is the lack of fresh water resources to meet the standard water demand. There are two type of water scarcity. One is physical. The other is economic water scarcity.
1. Tutorials Point, Simply Easy Learning
1 | P a g e
Apache ANT Tutorial
Tutorialspoint.com
Apache Ant is a Java based build tool from Apache Software Foundation. Apache Ant's build files
are written in XML and take advantage of the open standard, portable and easy to understand
nature of XML. For more detail kindly check tutorialspoint.com/ant
Why do you need a build tool?
Before diving deep into the definition of Apache Ant, one must understand the need for a build
tool. Why do I need Ant, or more specifically, why do I need a build tool?
Do you spend your day doing the following manually?
Compile code
Package the binaries
Deploy the binaries to the test server
Test your changes
Copy code from one location to another
If you have answered yes to any of the above, then it is time to automate the process and take
away that burden from you.
On average, a developer spends 3 hours (out of a 8 hour working day) doing mundane tasks
like build and deployment. Wouldn't you be delighted to get back the 3 hours?
Enter Apache Ant. Apache Ant is an operating system build and deployment tool that can be
executed from a command line.
Features of Apache Ant
Ant is the most complete Java build and deployment tool available.
Ant is platform neutral and can handle platform specific properties such as file
separators.
Ant can be used to perform platform specific tasks such as modifying the modified time
of a file using 'touch' command.
Ant scripts are written using plain XML. If you are already familiar with XML, you can
learn Ant pretty quickly.
Ant is good at automating complicated repetitive tasks.
Ant comes with a big list of predefined tasks.
Ant provides an interface to develop custom tasks.
Ant can be easily invoked from the command line and it can integrate with free and
commercial IDEs.
Installing Apache Ant
It is assumed that you have already downloaded and installed Java Development Kit (JDK) on
your computer. If not, please follow the instructions here.
Apache Ant is distributed under the Apache Software License, a fully-fledged open source
license certified by the open source initiative.
The latest Apache Ant version, including full-source code, class files and documentation can be
found at http://ant.apache.org.
2. Tutorials Point, Simply Easy Learning
2 | P a g e
1. Ensure that the JAVA_HOME environment variable is set to the folder where your JDK is
installed.
2. Download the binaries from http://ant.apache.org
3. Unzip the zip file to a convenient location using Winzip, winRAR, 7-zip or similar tools,
say c: folder.
4. Create a new environment variable called ANT_HOME that points to the Ant
installation folder, in this case c:apache-ant-1.8.2-bin folder.
5. Append the path to the Apache Ant batch file to the PATH environment variable. In our
case this would be the c:apache-ant-1.8.2-binbin folder.
Ant - Build Files
Typically, Ant's build file, build.xml should live in the project's base directory. Although you are
free to use other file names or place the build file in some other location.
For this exercise, create a file called build.xml anywhere in your computer.
<?xml version="1.0"?>
<project name="Hello World Project" default="info">
<target name="info">
<echo>Hello World - Welcome to Apache Ant!</echo>
</target>
</project>
Please note that there should be no blank lines or whitespaces before the xml declaration. If you
do, this may cause an error message when running the ant build - The processing instruction
target matching "[xX][mM][lL]" is not allowed.
All buildfiles require the project element and at least one target element.
The XML element project has three attributes :
Attributes Description
name The Name of the project. (Optional)
default The default target for the build script. A project may contain any number of
targets. This attribute specifies which target should be considered as the
default. (Mandatory)
basedir The base directory (or) the root folder for the project. (Optional)
A target is a collection of tasks that you want to run as one unit. In our example, we have a
simple target to provide an informational message to the user.
Targets can have dependencies on other targets. For example, a deploy target may have a
dependency on the package target, and the package target may have a dependency on the
compile target and so forth. Dependencies are denoted using the depends attribute. For
example:
<target name="deploy" depends="pacakge">
....
</target>
3. Tutorials Point, Simply Easy Learning
3 | P a g e
<target name="pacakge" depends="clean,compile">
....
</target>
<target name="clean" >
....
</target>
<target name="compile" >
....
</target>
The target element has the following attributes:
Attributes Description
name The name of the target (Required)
depends Comma separated list of all targets that this target depends on. (Optional)
description A short description of the target. (optional)
if Allows the execution of a target based on the trueness of a conditional
attribute. (optional)
unless Adds the target to the dependency list of the specified Extension Point. An
Extension Point is similar to a target, but it does not have any tasks.
(Optional)
Ant - Property Task
Ant build files are written in XML, which does not cater for declaring variables as you do in your
favourite programming language. However, as you may have imagined, it would be useful if Ant
allowed declaring variables such as project name, project source directory etc.
Ant uses the property element which allows you to specify properties. This allows the
properties to be changed from one build to another. or from one environment to another.
By default, Ant provides the following pre-defined properties that can be used in the build file
Properties Description
ant.file The full location of the build file.
ant.version The version of the Apache Ant installation.
basedir The basedir of the build, as specified in the basedir attribute of
the project element.
ant.java.version The version of the JDK that is used by Ant.
4. Tutorials Point, Simply Easy Learning
4 | P a g e
ant.project.name The name of the project, as specified in the name atrribute of the
project element
ant.project.default-target The default target of the current project
ant.project.invoked-targets Comma separated list of the targets that were invoked in the
current project
ant.core.lib The full location of the ant jar file
ant.home The home directory of Ant installation
ant.library.dir The home directory for Ant library files - typically ANT_HOME/lib
folder.
Ant also makes the system properties (Example: file.separator) available to the build file.
In addition to the above, the user can define additional properties using the property element.
An example is presented below which shows how to define a property called sitename:
<?xml version="1.0"?>
<project name="Hello World Project" default="info">
<property name="sitename" value="www.tutorialspoint.com"/>
<target name="info">
<echo>Apache Ant version is ${ant.version} - You are
at ${sitename} </echo>
</target>
</project>
Running ant on the above build file should produce the following output:
C:>ant
Buildfile: C:build.xml
info:
[echo] Apache Ant version is Apache Ant(TM) version 1.8.2
compiled on December 20 2010 - You are at www.tutorialspoint.com
BUILD SUCCESSFUL
Total time: 0 seconds
C:>
Ant - Property Files
Setting properties directly in the build file is okay if you are working with a handful of
properties. However, for a large project, it makes sense to store the properties in a separate
property file.
Storing the properties in a separate file allows you to reuse the same build file, with different
property settings for different execution environment. For example, build properties file can be
maintained separately for DEV, TEST and PROD environments.
5. Tutorials Point, Simply Easy Learning
5 | P a g e
Specifying properties in a separate file is useful when you do not know the values for a property
(in a particular environment) up front. This allows you to perform the build in other
environments where the property value is known.
There is no hard and fast rule, but typically the property file is named build.properties and is
placed along side the build.xml file. You could create multiple build properties file based on the
deployment environments - such as build.properties.dev and build.properties.test
The contents of the build property file are similar to the normal java property file. They contain
one property per line. Each property is represented by a name and a value pair. The name and
value pair are separated by an equals sign. It is highly recommended that the properties are
annotated with proper comments. Comments are listed using the has character.
The following shows a build.xml and an associated build.properties file
build.xml
<?xml version="1.0"?>
<project name="Hello World Project" default="info">
<property file="build.properties"/>
<target name="info">
<echo>Apache Ant version is ${ant.version} - You are
at ${sitename} </echo>
</target>
</project>
build.properties
# The Site Name
sitename=www.tutorialspoint.com
buildversion=3.3.2
Ant - Data Types
Ant provides a number of predefined data types. Do not confuse the data types that are
available in the programming language, but instead consider the data types as set of services
that are built into the product already
The following is a list of data types provided by Apache Ant
File Set
The Fileset data types represents a collection of files. The Fileset data type is usually used as a
filter to include and exclude files that match a particular pattern.
For example:
<fileset dir="${src}" casesensitive="yes">
<include name="**/*.java"/>
<exclude name="**/*Stub*"/>
</fileset>
The src attribute in the above example points to the source folder of the project.
6. Tutorials Point, Simply Easy Learning
6 | P a g e
In the above example, the fileset selects all java files in the source folder except those that
contain the word 'Stub' in them. The case sensitive filter is applied to the fileset which means
that a file with the name Samplestub.java will not be excluded from the fileset
Pattern Set
A pattern set is a pattern that allows to easily filter files or folders based on certain patterns.
Patterns can be created using the following meta characters.
1. ? - Matches one character only
2. * - Matches zero or many characters
3. ** - Matches zero or many directories recursively
The following example should give an idea of the usage of a pattern set.
<patternset id="java.files.without.stubs">
<include name="src/**/*.java"/>
<exclude name="src/**/*Stub*"/>
</fileset>
The patternset can then be reused with a fileset as follows:
<fileset dir="${src}" casesensitive="yes">
<patternset refid="java.files.without.stubs"/>
</fileset>
File List
The File list data type is similar to the file set except that the File List contains explicity named
lists of files and do not support wild cards
Another major difference between the file list and the file set data type is that the file list data
type can be applied for files that may or may not exist yet.
Following is an example of the File list data type
<filelist id="config.files" dir="${webapp.src.folder}">
<file name="applicationConfig.xml"/>
<file name="faces-config.xml"/>
<file name="web.xml"/>
<file name="portlet.xml"/>
</filelist>
The webapp.src.folder attribute in the above example points to the web application's source
folder of the project.
Filter Set
Using a Filter Set data type with the copy task, you can replace certain text in all files that
match the pattern with a replacement value.
A common example is to append the version nunber to the release notes file, as shown in the
example below
7. Tutorials Point, Simply Easy Learning
7 | P a g e
<copy todir="${output.dir}">
<fileset dir="${releasenotes.dir}" includes="**/*.txt"/>
<filterset>
<filter token="VERSION" value="${current.version}"/>
</filterset>
</copy>
The output.dir attribute in the above example points to the output folder of the project.
The releasenotes.dir attribute in the above example points to the release notes folder of the
project.
The current.version attribute in the above example points to the current version folder of the
project.
The copy task, as the name suggests is used to copy files from one location to another.
Path
The path data type is commonly used to represent a classpath. Entries in the path are
separated using a semicolon or colon. However, these characters are replaced a the run time by
the running system's path separator character.
Most commonly, the classpath is set to the list of jar files and classes in the project, as shown in
the example below:
<path id="build.classpath.jar">
<pathelement path="${env.J2EE_HOME}/${j2ee.jar}"/>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</path>
The env.J2EE_HOME attribute in the above example points to the environment variable
J2EE_HOME.
The j2ee.jar attribute in the above example points to the name of the J2EE jar file in the J2EE
base folder.
Ant - Building Projects
Now that we have learnt about the data types in Ant, it is time to put that into action. Consider
the following project structure
This project will form the Hello World project for the rest of this tutorial.
C:workFaxWebApplication>tree
Folder PATH listing
Volume serial number is 00740061 EC1C:ADB1
C:.
+---db
+---src
. +---faxapp
. +---dao
. +---entity
8. Tutorials Point, Simply Easy Learning
8 | P a g e
. +---util
. +---web
+---war
+---images
+---js
+---META-INF
+---styles
+---WEB-INF
+---classes
+---jsp
+---lib
Let me explain the project structure.
1. The database scripts are stored in the db folder.
2. The java source code is stored in the src folder.
3. The images, js, META-INF, styles (css) are stored in the war folder.
4. The JSPs are stored in the jsp folder.
5. The third party jar files are stored in the lib folder.
6. The java class files will be stored in the WEB-INFclasses folder.
The aim of this exercise is to build an ant file that compiles the java classes and places them in
the WEB-INFclasses folder.
Here is the build.xml required for this project. Let us consider it piece by piece
<?xml version="1.0"?>
<project name="fax" basedir="." default="build">
<property name="src.dir" value="src"/>
<property name="web.dir" value="war"/>
<property name="build.dir" value="${web.dir}/WEB-INF/classes"/>
<property name="name" value="fax"/>
<path id="master-classpath">
<fileset dir="${web.dir}/WEB-INF/lib">
<include name="*.jar"/>
</fileset>
<pathelement path="${build.dir}"/>
</path>
<target name="build" description="Compile source tree java files">
<mkdir dir="${build.dir}"/>
<javac destdir="${build.dir}" source="1.5" target="1.5">
<src path="${src.dir}"/>
<classpath refid="master-classpath"/>
</javac>
</target>
<target name="clean" description="Clean output directories">
<delete>
<fileset dir="${build.dir}">
<include name="**/*.class"/>
</fileset>
</delete>
</target>
</project>
First, let us declare some properties for the source, web and build folders.
9. Tutorials Point, Simply Easy Learning
9 | P a g e
<property name="src.dir" value="src"/>
<property name="web.dir" value="war"/>
<property name="build.dir" value="${web.dir}/WEB-INF/classes"/>
In this example, the src.dir refers to the source folder of the project (i.e, where the java source
files can be found).
The web.dir refers to the web source folder of the project. This is where you can find the JSPs,
web.xml, css, javascript and other web related files
Finally, the build.dir refers to the output folder of the project compilation.
Properties can refer to other properties. As shown in the above example, the build.dir property
makes a reference to the web.dir property.
In this example, the src.dir refers to the source folder of the project.
The default target of our project is the compile target. But first let us look at the clean target.
The clean target, as the name suggests deletes the files in the build folder.
<target name="clean" description="Clean output directories">
<delete>
<fileset dir="${build.dir}">
<include name="**/*.class"/>
</fileset>
</delete>
</target>
The master-classpath holds the classpath information. In this case, it includes the classes in the
build folder and the jar files in the lib folder.
<path id="master-classpath">
<fileset dir="${web.dir}/WEB-INF/lib">
<include name="*.jar"/>
</fileset>
<pathelement path="${build.dir}"/>
</path>
Finally, the build target to build the files. First of all, we create the build directory if it doesn't
exist. Then we execute the javac command (specifying jdk1.5 as our target compilation). We
supply the source folder and the classpath to the javac task and ask it to drop the class files in
the build folder.
<target name="build" description="Compile main source tree java files">
<mkdir dir="${build.dir}"/>
<javac destdir="${build.dir}" source="1.5" target="1.5" debug="true"
deprecation="false" optimize="false" failonerror="true">
<src path="${src.dir}"/>
<classpath refid="master-classpath"/>
</javac>
</target>
Running ant on this file will compile the java source files and place the classes in the build
folder.
10. Tutorials Point, Simply Easy Learning
10 | P a g e
The following outcome is the result of running the ant file:
C:>ant
Buildfile: C:build.xml
BUILD SUCCESSFUL
Total time: 6.3 seconds
The files are compiled and are placed in the build.dir folder.
Ant - Creating JAR files
The next logical step after compiling your java source files, is to build the java archive, i,e the
JAR file. Creating JAR files with Ant is quite easy with the jar task. Presented below are the
commonly used attributes of the jar task
Attributes Description
basedir The base directory for the output JAR file. By default, this is set to the base
directory of the project.
compress Advises ant to compress the file as it creates the JAR file.
keepcompression While the compress attribute is applicable to the individual files, the
keepcompression attribute does the same thing, but it applies to the
entire archive.
destfile The name of the output JAR file
duplicate Advises Ant on what to do when duplicate files are found. You could add,
preserve or fail the duplicate files.
excludes Advises Ant to not include these comma seperated list of files in the
package.
excludesfile Same as above, except the exclude files are specified using a pattern.
inlcudes Inverse of excludes
includesfile Inverse of excludesfile.
update Advises ant to overwrite files in the already built JAR file.
Continuing our Hello World project, let us add a new target to produce the jar files. But before
that let us consider the jar task:
<jar destfile="${web.dir}/lib/util.jar"
basedir="${build.dir}/classes"
11. Tutorials Point, Simply Easy Learning
11 | P a g e
includes="faxapp/util/**"
excludes="**/Test.class"
/>
In this example, the web.dir property points to the path of the web source files. In our case,
this is where the util.jar will be placed.
The build.dir property in this example points to the build folder where the class files for the
util.jar can be found.
In this example, we create a jar file called util.jar using the classes from the faxapp.util.*
package. However, we are exlcuding the classes that end with the name Test. The output jar file
will be place in the webapp's lib folder.
If we want to make the util.jar an executable jar file we need to add the manifest with the
Main-Class meta attribute.
Therefore the above example will be updated as:
<jar destfile="${web.dir}/lib/util.jar"
basedir="${build.dir}/classes"
includes="faxapp/util/**"
excludes="**/Test.class">
<manifest>
<attribute name="Main-Class"
value="com.tutorialspoint.util.FaxUtil"/>
</manifest>
</jar>
To execute the jar task, wrap it inside a target (most commonly, the build or package target,
and run them.
<target name="build-jar">
<jar destfile="${web.dir}/lib/util.jar"
basedir="${build.dir}/classes"
includes="faxapp/util/**"
excludes="**/Test.class">
<manifest>
<attribute name="Main-Class"
value="com.tutorialspoint.util.FaxUtil"/>
</manifest>
</jar>
</target>
Running ant on this file will create the util.jar file for us..
The following outcome is the result of running the ant file:
C:>ant build-jar
Buildfile: C:build.xml
BUILD SUCCESSFUL
Total time: 1.3 seconds
The util.jar file is now placed in the output folder.
12. Tutorials Point, Simply Easy Learning
12 | P a g e
Ant - Creating WAR files
Creating WAR files with Ant is extremely simple, and very similar to the creating JAR files task.
After all WAR file, like JAR file is just another ZIP file, isn't it?
The WAR task is an extension to the JAR task, but it has some nice additions to manipulate what
goes into the WEB-INF/classes folder, and generating the web.xml file. The WAR task is useful
to specify a particular layout of the WAR file.
Since the WAR task is an extension of the JAR task, all attributes of the JAR task apply to the
WAR task. Below are the extension attributes that are specify to the WAR task:
Attributes Description
webxml Path to the web.xml file
lib A grouping to specify what goes into the WEB-INFlib folder.
classes A grouping to specify what goes into the WEB-INFclasses folder.
metainf Specifies the instructions for generating the MANIFEST.MF file.
Continuing our Hello World Fax Application project, let us add a new target to produce the jar
files. But before that let us consider the war task. Consider the following example:
<war destfile="fax.war" webxml="${web.dir}/web.xml">
<fileset dir="${web.dir}/WebContent">
<include name="**/*.*"/>
</fileset>
<lib dir="thirdpartyjars">
<exclude name="portlet.jar"/>
</lib>
<classes dir="${build.dir}/web"/>
</war>
As per the previous examples, the web.dir variable refers to the source web folder, i.e, the
folder that contains the JSP, css,javascript files etc.
The build.dir variable refers to the output folder - This is where the classes for the WAR
package can be found. Typically, the classes will be bundled into the WEB-INF/classes folder of
the WAR file.
In this example, we are creating a war file called fax.war. The WEB.XML file is obtained from the
web source folder. All files from the 'WebContent' folder under web are copied into the WAR file.
The WEB-INF/lib folder is populated with the jar files from the thirdpartyjars folder. However,
we are exlcuding the portlet.jar as this is already present in the application server's lib folder.
Finally, we are copying all classes from the build directory's web folder and putting into the
WEB-INF/classes folder.
Wrap the war task inside an Ant target (usually package) and run it. This will create the WAR
file in the specified location.
13. Tutorials Point, Simply Easy Learning
13 | P a g e
It is entirely possible to nest the classes, lib, metainf and webinf directors so that they live in
scattered folders anywhere in the project structure. But best practices suggest that your Web
project should have the Web Content structure that is similar to the structure of the WAR file.
The Fax Application project has its structure outlined using this basic principle.
To execute the war task, wrap it inside a target (most commonly, the build or package target,
and run them.
<target name="build-war">
<war destfile="fax.war" webxml="${web.dir}/web.xml">
<fileset dir="${web.dir}/WebContent">
<include name="**/*.*"/>
</fileset>
<lib dir="thirdpartyjars">
<exclude name="portlet.jar"/>
</lib>
<classes dir="${build.dir}/web"/>
</war>
</target>
Running ant on this file will create the fax.war file for us..
The following outcome is the result of running the ant file:
C:>ant build-war
Buildfile: C:build.xml
BUILD SUCCESSFUL
Total time: 12.3 seconds
The fax.war file is now placed in the output folder. The contents of the war file will be:
fax.war:
+---jsp This folder contains the jsp files
+---css This folder contains the stylesheet files
+---js This folder contains the javascript files
+---images This folder contains the image files
+---META-INF This folder contains the Manifest.Mf
+---WEB-INF
+---classes This folder contains the compiled classes
+---lib Third party libraries and the utility jar files
WEB.xml Configuration file that defines the WAR package
Ant - Executing Java code
You can use Ant to execute java code. In this example below, the java class takes in an
argument (administrator's email address) and sends out an email.
public class NotifyAdministrator
{
public static void main(String[] args)
{
String email = args[0];
notifyAdministratorviaEmail(email);
System.out.println("Administrator "+email+" has been notified");
}
14. Tutorials Point, Simply Easy Learning
14 | P a g e
public static void notifyAdministratorviaEmail(String email)
{
//......
}
}
Here is a simple build that executes this java class.
<?xml version="1.0"?>
<project name="sample" basedir="." default="notify">
<target name="notify">
<java fork="true" failonerror="yes" classname="NotifyAdministrator">
<arg line="admin@test.com"/>
</java>
</target>
</project>
When the build is executed, it produces the following outcome:
C:>ant
Buildfile: C:build.xml
notify:
[java] Administrator admin@test.com has been notified
BUILD SUCCESSFUL
Total time: 1 second
In this example, the java code does a simple thing - to send an email. We could have used the
built in Ant task to do that. However, now that you have got the idea you can extend your build
file to call java code that performs complicated things, for example: encrypts your source code.
Further Detail:
Refer to the link http://www.tutorialspoint.com/ant
List of Tutorials from TutorialsPoint.com
Learn JSP
Learn Servlets
Learn log4j
Learn iBATIS
Learn Java
Learn JDBC
Java Examples
Learn Best Practices
Learn Python
Learn Ruby
Learn Ruby on Rails
Learn SQL
Learn ASP.Net
Learn HTML
Learn HTML5
Learn XHTML
Learn CSS
Learn HTTP
Learn JavaScript
Learn jQuery
Learn Prototype
Learn script.aculo.us
Web Developer's Guide
Learn RADIUS
15. Tutorials Point, Simply Easy Learning
15 | P a g e
Learn MySQL
Learn AJAX
Learn C Programming
Learn C++ Programming
Learn CGI with PERL
Learn DLL
Learn ebXML
Learn Euphoria
Learn GDB Debugger
Learn Makefile
Learn Parrot
Learn Perl Script
Learn PHP Script
Learn Six Sigma
Learn SEI CMMI
Learn WiMAX
Learn Telecom Billing
Learn RSS
Learn SEO Techniques
Learn SOAP
Learn UDDI
Learn Unix Sockets
Learn Web Services
Learn XML-RPC
Learn UML
Learn UNIX
Learn WSDL
Learn i-Mode
Learn GPRS
Learn GSM
Learn WAP
Learn WML
Learn Wi-Fi
webmaster@TutorialsPoint.com