JBoss.org Community Documentation

4.3. 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 Chapter 5, Setting the JBOSS_HOME variable .