পৃষ্ঠাসমূহ

Search Your Article

CS

Pageviews

Showing posts with label Ant Tutorial. Show all posts
Showing posts with label Ant Tutorial. Show all posts

Saturday, January 14, 2017

Ant - Executing Java code

You can use Ant to execute Java code. In the following example, the java class takes in an argument (administrator's email address) and sends out an email.

Ant - Deploying Applications

In the previous chapter, we have learnt how to package an application and deploy it to a folder.
In this chapter, we are going to deploy the web application directly to the application server deploy folder, then we are going to add a few Ant targets to start and stop the services. Let us continue with the Hello World fax web application. This is a continuation of the previous chapter, the new components are highlighted in bold.

Ant - Packaging Applications

We have learnt the different aspects of Ant using the Hello World Fax web application in bits and pieces.
Now it is time to put everything together to create a full and complete build.xml file. Consider build.properties and build.xml files as follows:

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.

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. The commonly used attributes of the jar task are as follows:

Ant - Build Documentation

Documentation is a must in any project. Documentation plays a great role in the maintenance of a project. Java makes documentation easier by the use of the in-built javadoc tool. Ant makes it even easier by generating the documentation on demand.

Ant - Building Projects

Now that we have learnt about the data types in Ant, it is time to put that knowledge into action. We will build a project in this chapter. The aim of this chapter is to build an Ant file that compiles the java classes and places them in the WEB-INF\classes folder.
Consider the following project structure:

Ant - Data Types

Ant provides a number of predefined data types. Do not confuse the term "data types" with those that are available in the programming language, instead consider them as a set of services that are built into the product already.

Discuss Apache Ant

Apache Ant is a Java based build tool from Apache Software Foundation. Apache Ant's build files are written in XML and they take advantage of being open standard, portable and easy to understand.
This tutorial should show you how to use Apache ANT to automate the build and deployment process in simple and easy steps. After completing this tutorial, you should find yourself at a moderate level of expertise in using Apache Ant from where you may take yourself to next levels.


Ant - Useful Resources

The following resources contain additional information on Apache ANT. Please use them to get more in-depth knowledge on this.

Ant - Quick Guide

ANT stands for Another Neat Tool. It is a Java-based build tool from Apache. Before going into the details of Apache Ant, let us first understand why we need a build tool in the first place.

Ant - Extending Ant

Ant comes with a predefined set of tasks, however you can create your own tasks, as shown in the example below.
Custom Ant Tasks should extend the org.apache.tools.ant.Task class and should extend the execute() method. Below is a simple example:

Ant - JUnit Integration

JUnit is the commonly used unit testing framework for Java-based developments. It is easy to use and easy to extend. There are a number of JUnit extensions available. If you are unfamiliar with JUnit, you should download it from www.junit.org and read its manual.

Ant - Eclipse Integration

If you have downloaded and installed Eclipse already, you have very little to do to get started. Eclipse comes pre bundled with the Ant plugin, ready to use.
Follow the simple steps, to integrate Ant into Eclipse.

Ant - Property Task

Ant build files are written in XML, which does not allow declaring variables as you do in your favorite 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 - Build Files

Typically, Ant's build file, called build.xml should reside in the base directory of the project. However there is no restriction on the file name or its location. You are free to use other file names or save the build file in some other location.

Ant - Environment Setup

Apache Ant Ant is distributed under the Apache Software License, a fully-fledged open source license certified by the open source initiative.

Ant - Introduction

ANT stands for Another Neat Tool. It is a Java-based build tool from Apache. Before going into the details of Apache Ant, let us first understand why we need a build tool in the first place.