Version 1
    Download and Installation                                                           
    Installing and configuring ANT
    Building with Apache ANT

    You can download the zip source file from http://labs.jboss.com/jbossas/downloads/.


    • Uncompress jboss-<release>-src.tar.gz to extract the archive contents into the location of your choice. You can do this using the tar archiving utility in Linux (or any other compatible extraction tool). In this example we are assuming your source files were copied in the /jboss folder.                
      [user@localhost]$ cd /jboss
      [user@localhost]$ tar -xvf jboss-<release>-src.tar.gz
    • You should now have a directory called jboss-<release>-src.tar.gz. The next step is to build your source files. In this example we are using Apache ANT. This is discussed in the following section.

    Installing and configuring ANT

    Apache Ant is a Java-based build tool. Instead of using an extended model using shell-based commands, Ant is extended using Java classes that use XML-based configuration files. The configuration files call out a target tree that executes various tasks. Each task is run by an object that implements a particular Task interface. This gives you the ability to perform cross platform builds. Please also note that if needed, Ant provides an <exec> task that allows commands to be executed based on the Operating System it is executing on. For more information on Apache ANT please click here.

      

    You will need to build your JBoss Application Server source files before you can run the application server. Apache Ant is shipped with the JBoss Application Server source files and can be executed from the <source_directory>/tools/bin directory.

      

    The source files can also be built using Apache Maven which is also shipped with the JBoss Application Server source files under <source_directory>/tools/maven directory. For more information about Apache Maven, please refer to http://maven.apache.org/.

      

    Like Java, you also need to set the environment variables for Apache ANT and/or Apache Maven. The following example illustrates a desirable configuration for the .bashrc file. In the example the file is edited using the gnome text editor (gedit).

      
    [user@localhost ~]$ gedit .bashrc

    # Source global definitions
    if [ -f /etc/bashrc ]; then
    /etc/bashrc
    fi
    ......
    # User specific aliases and functions
    # The following are the environment variables for Java , ANT and Maven
        
    export JAVA_HOME=/usr/java/jdk1.6.0_07/
    export PATH=$PATH:$JAVA_HOME/bin

    export ANT_HOME=/home/downloads/jboss-<source_directory>/tools/
    export PATH=$PATH:$ANT_HOME/bin

    export MAVEN_HOME=/home/downloads/jboss-<source_directory>/tools/maven
    export PATH=$PATH:$MAVEN_HOME/bin

     

    To implement the changes you've made to the .bashrc file, type the following on a terminal.

      
    [user@localhost ~]$ source .bashrc
    [user@localhost ~]$
      

    If any errors are displayed, please check your .bashrc file for errors and ensure that all directory paths are correct.


    Building with Apache ANT

    To build the JBoss Application Server source files with Apache ANT, from a terminal change directory to where the unzipped source files are. In the following example we are assuming that the source files were copied and unzipped in the logged in user's downloads folder.

    [user@localhost]$ cd /home/user/downloads/jboss-<release>-src/build
    [user@localhost build]$ ls
    aspects    component-matrix  docbook-support  iiop     jmx           mbeans          security    system-jmx  tools
    bootstrap  connector         ejb3             j2se     jmx-remoting  messaging       server      testsuite   varia
    build      console           embedded         jbossas  main          pom.xml         spring-int  thirdparty  webservices
    cluster    deployment        hibernate-int    jbossmq  management    profileservice  system      tomcat

    From the contents of the build directory above, you can see the build.xml file which is used by Apache ANT as a configuration file when building your source files. The next step is to perform the build using Apache ANT as illustrated below.

     

    [user@localhost build]$ ant
        
    compile-classes:
    [mkdir] Created dir: /jboss/jboss-<release>-src/tomcat/output/classes
    [javac] Compiling 89 source files to /jboss/jboss-<release>-src/tomcat/output/classes
    ....
    ....content truncated
    .....
    .....
    _buildmagic:build-bypass-check:
    jars:
    most:
    main:
    BUILD SUCCESSFUL
    Total time: 2 seconds

    A successful build will have the above message. If your build fails, please check the error log and ensure that your configuration files and environment variables are correctly set. The JBoss Application Server files are built under the build/output/jboss-<release> directory as indicated below.

    Note

    At this point the JBoss Application Server source files build is a hybrid one (builds in both Ant and Maven) because it declares all JBoss dependencies as maven2 artifacts, however after the dependencies are resolved/imported the legacy ant based build is used to compile and build the distribution. The JBoss Application Server source files will change to a full maven build soon.

     

    [user@localhost build]$ ls
    build.bat        build-old.xml      build-thirdparty-old.xml  eclipse.psf       output
    build-distr.xml  build-release.xml  build.xml                 etc               pom.xml
    build.log        build.sh           docs                      local.properties  VersionRelease.java

    [user@localhost build]$ cd output/jboss-<release>
    [user@localhost build]$ ls
    bin  client  docs  lib  server

    The jboss-<release> directory contains your successful JBoss Application Server files. You can copy this folder to a different location or run the server from this folder after setting the JBOSS_HOME environment variable in your .bashrc file. Next you need to set your JBOSS_HOME environment variables. This is discussed in Setting the JBOSS_HOME variable.