## Archive for March, 2013

After months of work, many improvements and bugfixes, a release, EasyAnt is graduated and will leave Apache Incubator in a couple of days.
The project will become a subproject of Ant (as Ivy did in the past).

The following things will change :

# The svn tree

We will move the svn tree of EasyAnt under Ant’s one. Everything except ‘KEYS’ and ‘site’ under http://svn.apache.org/repos/asf/incubator/easyant/ will move into http://svn.apache.org/repos/asf/ant/easyant .
We’ll give write rights to EasyAnt committers on the entire Ant svn tree.

# The website

EasyAnt website is using the same publication mechanism as Ant. We’ll need to move the svn tree of the site from http://svn.apache.org/repos/asf/incubator/easyant/site/ to http://svn.apache.org/repos/asf/ant/site/easyant . The web site will be at http://ant.apache.org/easyant
A redirection will be set from incubator/easyant to ant.apache.org/easyant

# The mailing lists

– easyant-dev@ will be closed in favor of dev@ant.apache.org
– easyant-commits@ will be closed in favor of notifications@ant.apache.org
– easyant-private@ just closed.

# Jira

No need to change anything, we will use the same : https://issues.apache.org/jira/browse/EASYANT

We will keep you posted once the migration is over.

Congrats again to the team !

EDIT The migration is over !

### Getting started with EasyAnt

In the course of this write up, you will be taken through basics of EasyAnt and a simple-and-live example of setting up an EasyAnt web application project. Prerequisite to your setting up an Easyant project means you have to have the Easyant environment correctly configured. The only thing you need to do to use easyant is to set the EASYANT_HOME property.

You should first set up in your environment the EASYANT_HOME variable :

• for windows users : set EASYANT_HOME=c:\path\to\easyant
• for unix users : export EASYANT_HOME=/path/to/easyant

You may also add EASYANT_HOME to your path :

• for windows users : set PATH=%EASYANT_HOME%\bin;%PATH%
• for unix users : export PATH=$EASYANT_HOME/bin:$PATH

Let us try to setup a java Web Application project.

EasyAnt provides skeleton feature to quickstart projects. It basically creates a projects structure, based on an existing model. You can fortunatly create your own skeleton but we will cover this in future articles.

Selecting available skeleton :

> easyant skeleton:select
-skeleton:select:
[echo] Choose a skeleton in the following list:
[ea:searchmodule] 1: std-skeleton v0.9 (Emtpy skeleton structure)
[ea:searchmodule] 2: std-java-application v0.9 (Skeleton for creating standard java application)
[ea:searchmodule] 3: std-ant-plugin v0.9 (Skeleton for creating ant based plugin for easyant)
[ea:searchmodule] 4: std-java-webapplication v0.9 (Skeleton for creating standard java web application)
[ea:searchmodule] Choose a number: (1, 2, 3, 4)

std-java-webapplication is what we are looking for, now it’s time to answer a few questions :


[input] The path where the skeleton project will be unzipped [.]

[input] Organisation name of YOUR project []
org.mycompany
[input] Module name of YOUR project
myproject
[input] Revision number of YOUR project [0.1]

Few seconds later we have our project ready to use.

Note: organisation, module, and revision terminology comes from Apache Ivy.

A project using EasyAnt MUST contain a file named module.ivy and an optional file named module.ant.

## The module.ivy file

This file is the module descriptor of your project. It contains information like your company name, the module name, dependencies, and Easyant build information. This is nearly a regular IVY specification file.

<ivy-module version="2.0" xmlns:ea="http://www.easyant.org">
<info organisation="my.easyant.project" module="my-webapp" status="integration" >
<description>
This project is a sample of a java webapplication
</description>
<ea:build organisation="org.apache.easyant.buildtypes" module="build-webapp-java" revision="0.9"/>
</info>
<configurations>
<conf name="default"/>
<conf name="test" />
</configurations>
<publications>
<artifact type="war"/>
</publications>
</ivy-module>

The above is a standard ivy specification file, other than the ‘ea:build’ tag. To use easyant you must declare the easyant namespace

xmlns:ea="http://www.easyant.org"

Pay attention to the ea:build tag. This tags define which build-type is used for your project. In our case, we intend to set up a standard war so we will use build-webapp-java which provides all the targets necessary to compile / package a webapp application.

Note: The organisation argument in ea:build tag is optional. If not specified easyant will use the default one (org.apache.easyant.buildtypes).

The above file is a sufficient instruction to easyant to build a WAR using the current project. Only, you need to mind the source structure for this build to work.

## Source Structure

Similar to Maven, by default, if you are using a standard build type, you need to follow a standard directory structure. This should be as the build type expects to pick different resources to be present in different directories.

Use the following:

In the above directory structure, all your java sources should go into src/main/java directory. All resources that should move into WEB-INF/classes directory should go inside src/main/resources. Entire src/main/webapp directory moves into the root of the web application WAR. For instance, you may keep WEB-INF directory inside this directory. The module.ivy file should reside inside ‘testproj’ directory. Any external dependencies of your project should be specified inside your module.ivy file, dependencies section.

## Building the Project

The project is now ready to be built. You can simply run: easyant. You should see a ‘target’ directory created in your project root. The built war will reside inside the target/artifacts directory. You can go ahead and deploy it in your app-server.

### Running default target

Running easyant without arguments will execute the default target of a project.

Example :

> easyant

### Running a specific extension point

Running EasyAnt with a extension point name will execute ALL the targets bound to it.

Example:

> easyant package

All targets related to the package extension point will be executed. Supposing your build is composed of several modules that generate packages (jar + source.jar + documentation.jar). All such packages will be generated. If your need is just to create the first jar, maybe you should call the explicit target instead.

### Running a specific target

Running EasyAnt with a target name or a list of names will execute only the specified targets.

Example:

> easyant package-jar:jar

### Displaying project help

Running EasyAnt with “-p” argument will display a project help (ie. show all extension point / target available)

Example:

> easyant -p

Dependencies are defined in the module.ivy files. There is a section dedicated to dependencies Let’s consider that our project needs an artifact named foo provided by acme in revision 2.0 The dependencies section will look like this :

<dependencies>
<dependency org="acme" name="foo" rev="2.0" conf="default"/>
</dependencies>

If you want to have more informations on dependencies please refer to the official ivy documentation

Almost everything is configurable through properties in easyant. Suppose we want to have the generated artifacts in “dist” directory instead of “target/artifacts”. We will add additional informations :

<ea:build organisation="org.apache.easyant.buildtypes" module="build-std-java" revision="0.9"/>
<ea:property name="target.artifacts" value="dist"/>
</ea:build>

Running “easyant” will generate the output war in “dist” directory.
Now we want to force java 1.5 compatibility at compile time. We will add additionnal property :

<ea:build organisation="org.apache.easyant.buildtypes" module="build-std-java" revision="0.9"/>
<ea:property name="target.artifacts" value="dist"/>
<ea:property name="compile.java.target.version" value="1.5"/>
</ea:build>


EasyAnt provides plugins that you can selectively choose to use in your project. These provide you convenience functionalities. E.g. Quick WAR deployments in Jetty, Xooki documentation, Coverage tools etc. In this tutorial, let us quickly take a look over how we may integrate Jetty with our current war. Let us first include a ‘Hello World’ index.htm inside the src/main/webapp directory. These are the contents of our index.htm:

<html>
<body>
<h3>Hello World !!</h3>
</body>
</html>

Our module.ivy is the repository of all plugins that our project uses. So, we go ahead and include the Jetty plugin in our module.ivy.

<ivy-module version="2.0" xmlns:ea="http://www.easyant.org">
<info organisation="my.easyant.project" module="my-webapp" status="integration" >
<description>
This project is a sample of a java webapplication
</description>
<ea:build organisation="org.apache.easyant.buildtypes" module="build-webapp-java" revision="0.9">
<ea:plugin organisation="org.apache.easyant.plugins" module="jetty-deploy" revision="0.9"/>
</ea:build>
</info>
<configurations>
<conf name="default" />
<conf name="test" />
</configurations>
<publications>
<artifact type="war"/>
</publications>
<dependencies>
<dependency org="acme" name="foo" rev="2.0" conf="default"/>
</dependencies>

</ivy-module>

Note the addition of the ea:plugin tag. The above line instructs easyant to use the jetty-deploy plugin in version 0.9 in the current project.

Note: The organisation argument in ea:plugin tag is optional. If not specified easyant will use the default one (org.apache.easyant.plugins).

The jetty-deploy module exposes a target called ‘jetty-deploy:run’. Further, this target depends on package-war:war of EasyAnt, which means that by the time this target is executed, the WAR would have been created and available for deployment on Jetty. Because, in the new line added to module.ivy, the jetty-deploy module was added you can run ‘easyant jetty-deploy:run’ to build and package your web application, and deploy it on jetty. The command launches jetty, and keeps displaying Jetty logs on console. You can now access your web application on browser. Try hitting http://localhost:8080 !

## module.ant

If you want to add something to the default build types that come packaged with EasyAnt, you can write a module.ant file in your project root. This is called before EasyAnt executes any of its core build scripts. You can also include any convenience targets you find useful, that are specific to your project and do not come included in EasyAnt. This will be covered in future article.

## Going further ?

If you want more information we strongly recommend you to read the Module files documentation.

### Apache EasyAnt 0.9-incubating released !

The Apache EasyAnt project is pleased to announce its 0.9-incubating release.

Apache Easyant is a toolbox focusing on easing project build processes.
It’s based on Apache Ant and Apache Ivy, and allows for maximum flexibily, improved integration in existing build systems and provides conventions and guidelines.

Our goals are :

• to leverage popularity and flexibility of Ant.
• to integrate Apache Ivy, such that the build system combines a ready-to-use dependency manager.
• to simplify standard build types, such as building web applications, JARs etc, by providing ready to use builds.
• to provide conventions and guidelines.
• to make plugging-in of fresh functionalities as easy as writing Ant scripts.

To still remain adaptable,

• Though EasyAnt comes with a lot of conventions, we never lock you in.
• EasyAnt allows you to easily extend existing modules or create and use your own modules.
• EasyAnt makes migration from Ant very simple. Your legacy Ant scripts could still be leveraged using EasyAnt.

Key features of this 0.9-incubating release are :

• dynamic project lifecycle to remain even more flexible (get rid of phases in favor of extension point)
• enhanced multimodule support
• enhanced exception handling
• support for offline mode
• new command line switches and related api to list and describe targets, properties, extensionPoints and even parameters (path, filesets)
• plugin dependencies can be overridden in module descriptors
• a set of new ant tasks to make plugin writer life easier
• a lighter distribution with only core plugins/buildtypes
• online repository for others plugins/buildtypes/skeletons
• upgrade to Apache Ant 1.8.4 and Apache Ivy 2.3.0
• numerous bug fixes as documented in Jira and in the release notes

This is the first EasyAnt release under Apache Software Foundation.

You can download this 0.9-incubating release at: