Getting Started with EL4Ant

This manual is designed to help you run your first EL4Ant project by reading as little documentation as possible. Of course the reading of the user's guide and the plugins documentation is recommended for a better understanding.



  • Sun Java SDK 1.4.2 (or compatible), XSLT support is needed for report generation.


  • Eclipse 3.1
  • Jakarta Tomcat 5.0 or later

Get EL4Ant

Download the latest ant+el4ant+helloworld package and unzip it anywhere you want in a new directory, which will be called INSTALL next.

Ant configuration

Check that the JAVA_HOME environment variable is defined with the path to your JVM installation.

Edit your PATH environment variable to include INSTALL/ant/bin.

From the command line, check your configuration with ant -version. The answer must be Apache Ant version 1.6.5 compiled on June 2 2005.

Deploy the HelloWorld web application

The HelloWorld application provides a module ready to be deployed as a web application. You need Tomcat to go further.

Jakarta Tomcat is the official Reference Implementation container for the Java Servlet and Java Server Pages technologies. It is released under the Apache Software License. Further information can be found at

Configure Tomcat

  • First download latest Tomcat 5.0 or Tomcat 5.5 and unzip the package in INSTALL. A directory has been created: for instance INSTALL/jakarta-tomcat-5.0.27, rename it into INSTALL/tomcat to suit the default configuration (in INSTALL/demo-project/plugins.xml, the j2ee-web.home attribute).
  • Edit the Tomcat user configuration file INSTALL/tomcat/conf/tomcat-users.xml and add an admin user with admin and manager role with a new line <user name="admin" password="password" roles="admin,manager"/>.
  • If you have changed the default Tomcat configuration, then other attributes in the j2ee-web-tomcat plugin must be changed too, as j2ee-web.port and j2ee-web.baseurl for instance.

Configure the HelloWorld project

From the command line, in INSTALL/demo-project, run

  ant -f bootstrap.xml

The project declared in INSTALL/demo-project/project.xml is now configured. In the console output, you can see configured plugins and modules declared in the project. Available targets in the generated build file can be listed with ant -projecthelp.

Deploy HelloWorld web application in Tomcat

From the command line, in INSTALL/demo-project, run

  ant compile

The web application context has been packaged in Tomcat webapps/ directory and either Tomcat has been started or its context has been refreshed. Corresponding source files are located in INSTALL/demo-project/helloworld/webresources/webapp, INSTALL/demo-project/helloworld/web/webapp and INSTALL/demo-project/helloworld/web/java.

Open the http://localhost:8080/helloworld/ location in your favorite browser to look at the result.

Use Ctrl-C to stop the Tomcat running in the console if it was launched by EL4Ant.

Other HelloWorld commands

Compile and start a basic application

From the command line, in INSTALL/demo-project, run

  ant jars

Java sources have been compiled, classes have been packed in jar files and the main class of the helloworldapp module has been started.

Corresponding source files are located in INSTALL/demo-project/helloworld/app/java and INSTALL/demo-project/helloworld/common/java.

You can change program arguments with the command:

  ant -Druntime.arguments="newarg1 newarg2"

or append arguments to the defined list in project.xml with:

  ant -Druntime.append.arguments="newarg3 newarg4"

To demonstrate the runtime hook feature, the project is configured to enable the JVM -verbose option with the jvmverbose system property set on the command line.

  ant -Djvmverbose=

The original JVM command line has been changed by the runtime.hook.jvm.verbose.

Generate the project reports

From the command line, in INSTALL/demo-project, run

  ant jars junit.start.all javadoc checkstyle website

The JUnit test cases have been run and reports have been generated in the project site. Open the dist/website/index.html location in your favorite browser to look at the result.

JUnit test cases source files are located in INSTALL/demo-project/helloworld/tests/java.

Generate the code coverage reports

To enable code coverage, a complete compilation with the system property emma set is needed.

  ant clean jars junit.start.all -Demma=t

To append code coverage information about the execution of the web application, you may also run the following:

  ant -Demma=t

Play a little with it to cover the servlet code, then the following command agregates coverage information and generate reports:

  ant website

Open the dist/website/index.html location in your favorite browser to look at the new generated reports.

Eclipse integration

Eclipse installation

Project configuration

  • Run ant -f bootstrap.xml from INSTALL/demo-project in the command line.
  • Then run ant eclipse.generate to install runnable Java commands in the workspace. The workspace must be reloaded if new commands have been added or changed.

Eclipse configuration

  • Start Eclipse and select the workspace INSTALL/workspace (default configuration in EL4Ant, in plugins.xml, eclipse.workspace.path attribute)
  • In the workbench, select the Java perspective (Window->Open Perspective->Java)
  • EL4Ant has generated one project per configured module. Import all project with File->Import..., select Existing projects into Workspace, Next and set root directory to INSTALL/demo-project, Select All and Finish.


  • The Run combo button contains a shortcut el4ant_startdev.helloworldapp.0 to do the equivalent of ant
  • The External Tool combo button contains shortcuts to invoke EL4Ant targets. el4ant_deploy.war.helloworldweb is the equivalent of ant Click on the red square button to stop Tomcat.
  • If you change the project description,
    • you have to import new projects corresponding to new modules,
    • you have to refresh modified projects,
    • you may have to reload the workspace after the execution of ant eclipse.generate.
  • Keep in mind that the EL4Ant configuration step generates Eclipse project files (.project, .classpath), so any manual changes in Eclipse interface are lost at next automatic configuration.

Create a new project

You just have to copy INSTALL/el4ant/project-template, for instance INSTALL/myproject. In your Eclipse workspace, you will have to import (or delete) modules (as Eclipse projects) corresponding to your changes in your project description, after EL4Ant configuration step.

In case you do not copy the project template in INSTALL, you have to edit myproject/etc/ to make the property point to INSTALL/el4ant/lib.

Getting help

Please use SourceForce forum

Revision: r1.10 - 27 Jun 2006 - 10:33 - YvesMartin
EL4Ant > GettingStarted
Copyright © 2004 by ELCA. All material on this collaboration platform should not be disclosed outside of ELCA.
Ideas, requests, problems regarding TWiki? Send feedback.