Building MARS With Ant

From Multiverse

Jump to: navigation, search

Overview

The most straightforward way to build MARS is to use Ant, the open source Apache build tool. Although it is highly recommended to use an IDE such as Eclipse or NetBeans as your development environment, you can also use Ant along with a decent text editor. For more information on using an IDE, see Setting Up a Development Environment.

General procedure

This procedure will work on either Linux or Windows, but the following procedure uses Windows with Cygwin.

Follow these steps:

  1. Download Ant.
  2. Extract the zip file to c:\, which will create a directory c:\apache-ant-version containing all the Ant files, where version is the version of Ant you downloaded, for example, C:\apache-ant-1.7.0.
  3. Edit your .bashrc file and add the following lines
    export ANT_HOME=c:/apache-ant-1.7.0
    export PATH=${PATH}:${ANT_HOME}/bin
    
  4. Re-execute your .bashrc by typing:
    source ~/.bashrc
    
  5. Backup your existing mars.jar file, in case you ever want to go back to the "original." This is optional, but highly recommended:
    cp dist/lib/mars.jar dist/lib/mars-backup.jar
    
  6. Make sure your servers are not running, then enter this command (still in the top level Multiverse directory, MV_HOME):
    ant -f build_mars.xml -lib ./dist/lib 
    

    The -f option tells ant to use the build file mars_build.xml. The -lib option tells it to look in the Multiverse distribution library folder for additional jar files that may be needed during the build.

    This script will initially create an MV_HOME/build directory to contain the compiled Java class files. Thenceforth, it will simply rebuild these class files. Then, it will put all the MARS class files into a JAR (Java archive) file, mars.jar (in the MV_HOME/dist/lib directory).

Now, start the servers as you normally do; the servers will use your version of MARS, instead of the original. If you ever want to revert to the original, simply rename mars-backup.jar back to mars.jar.

Personal tools