Getting Started

Here is a Quick Start tutorial to undestand how to use EasyAnt in your project.

The Command Line

Running default target

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

Running a specific phase

Running EasyAnt with a phase name will execute ALL the targets bound to this phase.
Example:
> easyant package
All targets related to the package phase 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 jar:jar

Displaying project help

Running EasyAnt with "-p" argument will display a project help (ie. show all phases / target available)
Example:
> easyant -p
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.

A short example

<ivy-module version="2.0" xmlns:ea="http://www.easyant.org"> 
<info organisation="org.mycompany" module="myJavaApp" status="integration" >
<ea:build organisation="org.apache.easyant.buildtypes" module="build-std-java" revision="0.2"/>
</info>
<configurations>
<conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf"/>
<conf name="test" visibility="private" description="this scope indicates
that the dependency is not required for normal use of the application, and is
only available for the test compilation and execution phases."/>
</configurations>
</ivy-module>
In this module descriptor, we have an application named myJavaApp created by org.mycompany.
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 this example we use build-std-java which provides all the targets necessary to compile / package a standard java application.
Note: The organisation argument in ea:build tag is optional. If not specified easyant will use the default one (org.apache.easyant.buildtypes).
Running easyant with this example will run the default target (package).
A few seconds later, you will have the generated jar in your_project/target/artifacts/myJavaApp.jar.

Changing build-system properties

So now we want to change several things on this build system.
For example, we want to use the "run:run" feature that allows a user to compile/start a standard java application (ie. a project with a main class).
And we want to have the generated jar in "dist" directory instead of "targets/artifacts".
We will add additional informations inside tag.
<ea:build organisation="org.apache.easyant.buildtypes" module="build-std-java" revision="0.2"/>
<ea:property name="target.artifacts" value="dist"/>
</ea:build>
Running "easyant" will generate the output jar in "dist" directory.

Using additional plugins

In some cases, we want to use several features that are not included in the default build-type provided by easyant.
If your project needs to use a specific plugin, you can use the tag inside tag.
Example:
Suppose we want to use code coverage feature.
<ea:build organisation="org.apache.easyant.buildtypes" module="build-std-java" revision="0.2"/>
<ea:property name="target.artifacts" value="dist"/>
<ea:plugin org="org.apache.easyant.plugins" module="emma" revision="0.1"/>
</ea:build>
Calling to "easyant -p" we should see the emma public target :
org.apache.easyant.plugins#emma.:emma     generate emma covera report
As you can see the target is prefixed by the project name.
Most of the time the project name is quite long so easyant allows you to define aliases for the project names. Such an alias can be used in place of the complete project name. You can define an alias for a plugin using "as" argument as below.
<ea:build organisation="org.apache.easyant.buildtypes" module="build-std-java" revision="0.2"/>
<ea:property name="target.artifacts" value="dist"/>
<ea:plugin org="org.apache.easyant.plugins" module="emma" revision="0.1" as="emma"/>
</ea:build>
Calling to "easyant -p" we should see the emma public target :
emma:emma generate emma covera report
Note: The organisation argument in ea:plugin tag is optional. If not specified easyant will use the default one (org.apache.easyant.plugins).

Going further ?

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