Ant Script

View previous topic View next topic Go down

Ant Script

Post by BIT0112-Rokon on Sat Dec 12, 2009 4:42 am

Guys, Read it carefully...This article explains how to write a very basic ANT build script. This does not explain indepth knowledge on building your project using ANT script. But, this writeup will be more useful for the beginners who haben't writen any ANT script before. Before start writing the script, lets look into how to install the ANT in your machine.
Install Apache Ant

Download the Apache Ant from the link : Download Apache Ant

  • Unzip the files into your machine.
  • Set your system path variable to ANT's bin directory. For example d:/projects/ant/bin"
  • Set the ANT_HOME in your system variables. ANT_HOME should point to your Ant installation directory. For example "d:/projects/ant".
  • Set JAVA_HOME in your system environment variables.
  • Copy tools.jar file into the "JRE/lib" folder.
To test the setup open your command prompt and type as "ant". You will see a message saying
Buildfile: build.xml does not exist!
Build failed
Set up is done. Let's look into our first simple example program using ANT script.This example program shows how to create the JAR file after building all the java files.

In the above code "sampleProject" is the project name for this prticular build. We are setting base directory as the current directory by just giving .(dot). We are telling the script to start from "jar" target name. The default attribute is used for setting the starting point for the ANT script.

We call a seperate task as target. We can define as many number of targets inside a build file. If we closely look into the build file, we have many number of targets based its operations. So, our build starts with "jar" target.

Target has depends attribute to indicate, that particular task can be executed only after the certain number of dependencies. In our case, before building the jar file, we have to compile the files. So, jar target calls compile target. That has some dependencies that is executed. Once the build is successful, test.jar will be created in the same directory.
Download example from here: exmple.rar

This example program shows how to create the JAR file after building all the java files.

anyway,Suzan Sir gave a bulid ant Scipt. you can download from here: build.rar
Ok best of luck.


Last edited by BIT0112-Rokon on Sun Jun 05, 2011 11:32 am; edited 3 times in total

_________________________________________________________________


Code Explosion Blog | Code Explosion Wiki | The Rokonoid | নির্ঝরিণী
avatar
BIT0112-Rokon
Programmer
Programmer

Course(s) :
  • BIT

Blood Group : O+
Posts : 673
Points : 1269

View user profile http://blog.codexplo.org

Back to top Go down

Re: Ant Script

Post by BIT0122-Amit on Sat Dec 12, 2009 5:06 am

the build file mirror is also available here..
build.rar
and the example mirror is here:
example.rar

_________________________________________________________________
Adminship / Moderatorship is not about power, it is about Responsibility.

|About me|My Blog|
avatar
BIT0122-Amit
Founder
Founder

Course(s) :
  • BIT

Blood Group : O+
Posts : 4187
Points : 6605

View user profile http://iitdu.forumsmotion.com

Back to top Go down

Re: Ant Script

Post by BIT0122-Amit on Mon Dec 14, 2009 7:43 pm

Oye rokon, mind seeing this?

Error!

Dang. I couldn't find that page. The error is:

404 - page not found for http://encodable.com/uploaddemo/files/build.rar
Referring page: http://encodable.com/cgi-bin/filechucker.cgi?action=landing&path=/&file=build.rar
This comes up when I try to download the build.rar file you linked.

_________________________________________________________________
Adminship / Moderatorship is not about power, it is about Responsibility.

|About me|My Blog|
avatar
BIT0122-Amit
Founder
Founder

Course(s) :
  • BIT

Blood Group : O+
Posts : 4187
Points : 6605

View user profile http://iitdu.forumsmotion.com

Back to top Go down

Re: Ant Script

Post by BIT0112-Rokon on Wed Jan 20, 2010 9:20 am

Here mirror is the solution..Thanks Amit to provide mirror...

_________________________________________________________________


Code Explosion Blog | Code Explosion Wiki | The Rokonoid | নির্ঝরিণী
avatar
BIT0112-Rokon
Programmer
Programmer

Course(s) :
  • BIT

Blood Group : O+
Posts : 673
Points : 1269

View user profile http://blog.codexplo.org

Back to top Go down

Re: Ant Script

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum