Setting up Ant to build Expresso

This document describes a building system for Expresso, using the Ant which a Java-based build tool developed by Sun and now hosted at the Apache Software Foundation jakarta site, and used for the Jakarta Project . Ant is much like Make, but different in that instead of a model where it is extended with shell-based commands, Ant is extended using Java classes. Instead of writing shell commands, the configuration files are XML-based, calling out a target tree where various tasks get executed. Each task is run by an object that implements a particular Task interface.

Version

Expresso 5.x

Author:

Ralph Jaeger and other Contributors

Introduction

Ant is a Java-based build automation tool that removes many of the pitfalls associated with building large Java codebases. As mentioned it is possible to set up a CVSROOT and other environment variables to automate CVS operation. Ant is an open source portable Java technology build faciliaty that is XML driven that is independent of the IDE. Basicially it is a Make replacement without all of Makes idiosyncracies.

Ant simplifies and automates the often complex process associated with deployment for the J2EE platform. It offers direct integration with test harnesses (Junit which we also use) and version control systems (CVS).Please download ANT from http://ant.apache.org/. Have a look at the very powerful Ant Task which can be setup to search a specified directory structure for files that meet a predefined filter pattern; such functionality plays a key role in the autodiscovery of framework components.

This document describes a building system for Expresso, using the Ant build-tool .

Basic Requirements:Currently to build Expresso with ANT, you will need the following:

  • ANT 1.5 or later - The most recent build system from Apache project. The current stable version of Ant at the time of this writing is Ant-1.5. If you have an older version of ANT, you will need to upgrade to the latest since the build.xml file utilizes some features specific to ANT 1.5. Out of the box, Ant supports Unix/Linux and Windows.

  • Tomcat 4.04 or later - This is the default Servlet container that we develop with. It is required to do the build-all or build-complete targets

It's easy....honest! The detailed instructions below look more daunting than the process really is! Here is a summary of steps:

  • Get and install Ant
  • Get Expresso source.
  • cd into the base expresso directory, there you will see a build.xml file.
  • Invoke Ant using "ant build <target>" which could be"ant build expresso-binary"

Options for Building Expresso

There are many ways to build Expresso and depending on your needs depends on how you may choose to build the tool.

Philosophy of building Web Applications with Expresso

Expresso's philosophy of building web application is to build your application into the Expresso framework as opposed to adding Expresso to your application like Struts does.  For symatics sake Expresso refers to client applications as components.  To make more sense of this lets examine the directory structure of expresso for a moment.

DirectoryLayout2

expresso-web/expresso/componets is where your htdocs files for your own components go and usually it is preferred to add you component class files as a jar file int the WEB-INF/lib directory.  As for your config file those get added in with the Expresso config file in WEB-INF/config.

Build your application in expresso or place Expresso jar within  your application

This is the "Struts-ish" mentality of building web applications with expresso.  While this method does work its not considered best practices because Expresso's model is so that you build web applications into Expresso not the other way around.

Option 1 Running Expresso and components like eForums from downloads (easiest route, no Ant required)

Download the expressoXXXX-bin.war from the jcorporate site and unwar it into your webapps directory.   Next download eforumxxx-bin.zip and unzip into the base directory of your unwar'ed expresso, ie expresso5.0.3.  This will automatically place the eforum files into their correct location.

Start Tomcat!  Done.

Option 2 Building client application code in a static version of Expresso (useful for those building client code with a static Expresso)

This option is for those who have no interest in modifying Expresso's files and build their own application to that expresso code base.  Download expresso-xxxx-bin.war and unwar it.  Create a directory in expressoxxxx/expresso called components and make that your client code docroot.   Set your EXPRESSO_HOME env variable for your base directory, so if you unzipped expresso in c:\projects then make that your value for the env variable.  Have your client application Ant file turn your class files into a jar and place that jar in WEB-INF/lib and copy your config files into WEB-INF/config.  

Option 3 Building Expresso and components like eForums from downloads src archives or CVS (This includes using Ant for both Expresso and component code, Preferred for Expresso developers or those who might want editable access to expresso source)

This is very safe way to build your war files for deployment because if ensures that you can always recover because you have all of the source and all could is built from that source.  Download expressoxxx-src.zip and eforumxxx-src.zip and unzip them in seperate directory locations (or download from CVS).  Set your EXPRESSO_HOME env variable for your base directory, so if you unzipped expresso in c:\projects then make that your value for the env variable.  Next take notice of the eforum build file, this will be the "master" file that builds your war.  To build a clean version of Expresso with eforum included call the Ant target called expresso-eforum-binary, then upon success call ant deploy-component-war.  This build file model can be used for building and integration your own Expresso app into Expresso. You will also need to download the Developers Bundle.zip or download the lib module from CVS to build Expresso. For further help on building from CVS see this.  

Building Expresso From CVS

  1. You should have already downloaded the CVS expresso module into your EXPRESSO_INSTALL_DIR. For more information on downloading the tree see more detail here.
  2. Next you need to download the jar files needed to build expresso not necessary needed for running though. This is done by executing the following command from your EXPRESSO-INSTALL-DIR
    cvs -d :pserver:guest@jcorporate.com:/home/javacorp/.cvs/expresso checkout lib
  3. cd into the primary build file located in EXPRESSO-INSTALL-DIR/expresso/. And if you haven't installed ANT now would be the time to do so!
  4. Next you will need to get the Cryptography Extensions, this is down by exceuting the following ANT command
    ant get-crypt
  5. Now you should be ready to start building. Depending on what kind of build will depend on what you do next. For a full listing of the possible builds you can do simply type
    ant
    in the same directory as the primary build file is located.
  6. For starters try typing
    ant build

Deploying and Testing your new build on Tomcat Catalina

  1. First you must make a WAR file, this is best achived by the following build target expresso-binary
    ant expresso-binary
  2. Now that you have a WAR file move it to your TOMCAT's webapps directory. This is best done via the following build target Note: If you want this next step to work you wll need to have your TOMCAT env variable set. deploy
    ant deploy
  3. Start TOMCAT and hit the expresso home page which in most cases would be http://localhost:8080/expresso/frame.jsp.

Example Built Scripts

Here are some example build scripts that are unsupported and only provided as examples. If you have suggestions for enhancement or correctness, let us know.

You might want to use right-click "Save Target As" to store the files above, to prevent your browse

Copyright © 2001-2003 Jcorporate Ltd. All rights reserved. Copyright Privacy

Last Modified: 27-Aug-2003