Quantcast
Viewing all articles
Browse latest Browse all 40

Ant | Hello World Ant Project

Apache Ant is an open source, cross-platform based build tool that is used to describe a build  process and its dependencies and implemented in XML scripts using Java classes that ensures its extensible to any development environment (based on Java) and its  integrity with other build tools.

This article is about how to start with ant tool. In this article I am going to create a Java Project and will create a jar file  of  java project using ant file.

In my previous post I have written about Eclipse | Hello World Java Project. I am  going to use same project and here also.

So my project structure will be as below:

Image may be NSFW.
Clik here to view.

 

 

 

 

 

 

Now to introduce ant file create a xml file using File–> New wizard and  name it projectBuilder.xml and place below code in xml file.

  1. <project name="AntProject" default="makejar" basedir=".">
  2. <target name ="makejar" description="Create a jar for the ant project">
  3.    <jar jarfile="HelloWorld.jar" includes="*.class" basedir="bin"/>
  4. </target>
  5. </project>

  
Now right click on projectbuilder.xml select run as ant file. As the execution stops refresh the ant project.
A jar file named HelloWorld.jar will be in root project folder.

Image may be NSFW.
Clik here to view.

Viewing all articles
Browse latest Browse all 40

Trending Articles