Deprecated: Assigning the return value of new by reference is deprecated in /home/techmasa/public_html/wp-content/plugins/sem-cosmos-link/sem-cosmos-link.php on line 90

Deprecated: Assigning the return value of new by reference is deprecated in /home/techmasa/public_html/wp-content/plugins/sem-recent-posts.php on line 942

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/techmasa/public_html/wp-content/plugins/sem-cosmos-link/sem-cosmos-link.php:90) in /home/techmasa/public_html/wp-content/plugins/wordpress-automatic-upgrade/wordpress-automatic-upgrade.php on line 121

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/techmasa/public_html/wp-content/plugins/sem-cosmos-link/sem-cosmos-link.php:90) in /home/techmasa/public_html/wp-content/plugins/wordpress-automatic-upgrade/wordpress-automatic-upgrade.php on line 121
TechMasala - Technology Spice Rack » Build Automation #3 - Ant in action

Build Automation #3 - Ant in action

We will execute a simple Ant script today. While most of what I am going to present in this post and the next post is just an eye opener to Ant, you can get much in depth details, examples and tutorials by Googling around. The example in this post and the coming post(s) assume that you know Java. Download this small project that has the source and ant script file to package a Hello World program. The default distribution type for any java application is a java archive file, so we are going to build that. To execute the script you need to download Ant and configure it. Once you have set it up, go to DOS prompt and type the following command.

ant -version

If you have setup Ant correctly, you should be seeing an output something like this.

Apache Ant version 1.6.5 compiled on June 2 2005

This example runs unit tests using JUnit, so once you extract the zip file, create a folder called lib and copy the junit-3.8.1.jar into the lib folder (for want of space I removed it from the zip). This step is important, otherwise the build will fail.Once you have completed the above steps, assuming you have extracted the project under c:\HelloWorld, at the HelloWorld folder in the DOS prompt execute,

c:\HelloWorld\>ant

If you installed and configured everything correct you should see a successful build. Goto the target folder and see if HelloWorld.jar file is there. To make sure you can execute the HelloWorld application from the jar, execute the following command.

c:\HelloWorld\target\>java -cp .\HelloWorld.jar com.compassites.HelloWorld

Now with this basic script, you can keep adding your source file and with one command you can package all your source into a jar that you can distribute. We will look into the build.xml and understand the script in the next post.


Deprecated: Function ereg_replace() is deprecated in /home/techmasa/public_html/wp-content/plugins/sociable/sociable.php on line 64
Blink this Build Automation #3 - Ant in action at blinklist.com    Bookmark Build Automation #3 - Ant in action at blogmarks    Bookmark Build Automation #3 - Ant in action at del.icio.us    Digg Build Automation #3 - Ant in action at Digg.com    Fark Build Automation #3 - Ant in action at Fark.com    Bookmark Build Automation #3 - Ant in action at Furl.net    Bookmark Build Automation #3 - Ant in action at NewsVine    Bookmark Build Automation #3 - Ant in action at reddit.com    Bookmark Build Automation #3 - Ant in action at Simpy.com    Bookmark Build Automation #3 - Ant in action at Spurl.net    Bookmark Build Automation #3 - Ant in action with wists    Bookmark Build Automation #3 - Ant in action at YahooMyWeb

      Cosmos

Leave a Comment

authimage


Creative Commons License  This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.