Build.xml File
Ant
is a build tool that means the main aim of Ant tool is to automation Java Project
process. By default ant uses build.xml file for writing build script. It is an
XML file. It is a standard file name followed by everyone. It is not mandatory.
We can use any filename like banking.xml, bank-build.xml etc, we can use ant
tool to do the following things
o
Create
directories
o
Delete
directories
o
Copy
files from one directory to another directory
o
Create
new files
o
Compile
and run java files
o
Create
a war file
o
Create
jar file
o
Create
an ear file
o
Deploy
war or ear into a server etc.
Build.xml File Architecture
Content of build.xml file:
Each Java project contains one or more build script files. Each
script file contains a project. Default build file name is ‘build.xml’, but we
can use any name. Ant’s build files are written in XML.
Project:
We can represent this project by
using <project> element and it contains some attributes like attribute “name”
is use to specify project name etc.
That means build.xml contains <project>
as root element.
Example:-
<project name = “bank”….>
</project>
The <project> tag has three attributes:
§ Name
§ Default
§ Basedir
<project> attributes description:
o
The
name attribute gives the project name.
o
The
default attribute refers to a target name within the build file. If you run Ant
without Specifying a target
on the command line, Ant executes the default target. If the default target. If
the default target doesn't exist, Ant returns an error.
o
The basedir attribute defines the root directory of a project. Typically, it is “.”,
the directory you're in when you run Ant. However, basedir can also define
different points of reference.
Target:
Each<project> contains
a set of targets. At least one target is mandatory.
We can
represent this target using <target> element just like <project>,
each target contains one name. We can represent this target name using “name”
attribute. We should provide unique target names within one build script file
Post a Comment
Nice Tutorial. Your Tutorial has the Best Signs professionalism. Please do more to make it true.
thanks so much, but my my question is how to make blog with domain blogspot.in , blogspot.tw etc ??
Post a Comment