Building Apache James from source using CLI

Lately I have been working with the Apache James mail server, and I have needed to build it from source. The process is fairly easy but not well documented at the Apache James site. Here is how I got a good build:

if all you want is to build the source, you can accomplish that without too much fuss. You will need some tools installed on your system if you don't have them already - Maven and Subversion.

maven.apache.org

subversion.apache.org

If you don't have those tools installed, get them installed. Next, go to a command prompt, create a folder for James and check out the source code for James at the trunk:

mkdir james

cd james

svn checkout http://svn.apache.org/repos/asf/james/project/trunk

This will create a folder called trunk inside of the james folder and populate it with the James source code.

 

Next, check your MAVEN_OPTS, which are probably not set:

echo $MAVEN_OPTS

 

If you see nothing, check this article to set your MAVEN_OPTS for your platform. 512M/128M are good settings for James.

https://cwiki.apache.org/confluence/display/MAVEN/OutOfMemoryError

Verify your settings.

echo $MAVEN_OPTS

 

You should see something like:

-Xmx512m -XX:MaxPermSize=128m

 

Next, run the build.

cd trunk

mvn clean install -DskipTests=true

 

On my new MacBookPro it takes roughly a minute to do the build. If I leave off the -DskipTests=true directive, it takes my machine roughly 5 1/2 minutes to run the tests and do the build. 

You will see a lot of console output. At the end of a successful build you should see something like this:

[INFO] Reactor Summary:

[INFO] 

[INFO] Apache James :: Server ............................. SUCCESS [  5.710 s]

[INFO] Apache James :: Server :: Data  :: API ............. SUCCESS [  2.922 s]

[INFO] Apache James :: Server :: Lifecycle API ............ SUCCESS [  0.574 s]

[INFO] Apache James :: Server :: Filesystem API ........... SUCCESS [  0.731 s]

[INFO] Apache James :: Server :: Mailetcontainer API ...... SUCCESS [  0.357 s]

[INFO] Apache James :: Server :: Common Utilities ......... SUCCESS [  1.212 s]

[INFO] Apache James :: Server :: Protocols Library ........ SUCCESS [  1.154 s]

[INFO] Apache James :: Server :: Core ..................... SUCCESS [  0.832 s]

[INFO] Apache James :: Server :: Container Spring ......... SUCCESS [  3.189 s]

[INFO] Apache James :: Server :: Client ................... SUCCESS [  1.096 s]

[INFO] Apache James :: Server :: DNS Service :: API ....... SUCCESS [  0.191 s]

[INFO] Apache James :: Server :: DNS Service :: Library ... SUCCESS [  0.498 s]

[INFO] Apache James :: Server :: Mail Queue :: API ........ SUCCESS [  0.373 s]

[INFO] Apache James :: Server :: Mailetcontainer Camel .... SUCCESS [  1.939 s]

[INFO] Apache James :: Server :: Mailbox Adapter .......... SUCCESS [  0.515 s]

[INFO] Apache James :: Server :: DNS Service :: Implementation SUCCESS [  0.499 s]

[INFO] Apache James :: Server :: Data :: Library .......... SUCCESS [  0.732 s]

[INFO] Apache James :: Server :: Data :: LDAP Implementation SUCCESS [  0.311 s]

[INFO] Apache James :: Server :: SMTP ..................... SUCCESS [  1.905 s]

[INFO] Apache James :: Server :: IMAP ..................... SUCCESS [  0.724 s]

[INFO] Apache James :: Server :: LMTP ..................... SUCCESS [  0.818 s]

[INFO] Apache James :: Server :: POP3 ..................... SUCCESS [  0.756 s]

[INFO] Apache James :: Server :: FetchMail ................ SUCCESS [  0.500 s]

[INFO] Apache James :: Server :: Mail Queue :: File ....... SUCCESS [  0.344 s]

[INFO] Apache James :: Server :: Mail Queue :: JMS ........ SUCCESS [  1.249 s]

[INFO] Apache James :: Server :: Mail Queue :: ActiveMQ ... SUCCESS [  0.741 s]

[INFO] Apache James :: Server :: Mailets .................. SUCCESS [  1.483 s]

[INFO] Apache James :: Server :: Data :: File Persistence . SUCCESS [  0.554 s]

[INFO] Apache James :: Server :: Data :: JPA Persistence .. SUCCESS [  1.619 s]

[INFO] Apache James :: Server :: Data :: JDBC Persistence . SUCCESS [  0.730 s]

[INFO] Apache James :: Server :: Data :: HBase Persistence  SUCCESS [  7.145 s]

[INFO] Apache James :: Server :: Data :: JCR Persistence .. SUCCESS [  1.216 s]

[INFO] Apache James :: Server :: App ...................... SUCCESS [ 10.561 s]

[INFO] Apache James :: Karaf :: Features .................. SUCCESS [  0.225 s]

[INFO] Apache James :: Karaf :: James Server .............. SUCCESS [ 10.479 s]

[INFO] Apache James :: Karaf :: Integration tests ......... SUCCESS [  6.002 s]

[INFO] ------------------------------------------------------------------------

[INFO] BUILD SUCCESS

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 01:12 min

[INFO] Finished at: 2014-10-18T09:05:37-07:00

[INFO] Final Memory: 111M/433M

 

Next, go into the folder and check the build files:

 

cd app/target

 
List the folder contents and you should see:
 

appassembler

archive-tmp

classes

generated-sources

generated-test-sources

james-server-app-3.0.0-beta5-SNAPSHOT

james-server-app-3.0.0-beta5-SNAPSHOT-app.tar.gz

james-server-app-3.0.0-beta5-SNAPSHOT-app.zip

james-server-app-3.0.0-beta5-SNAPSHOT-sources.jar

james-server-app-3.0.0-beta5-SNAPSHOT-test-sources.jar

james-server-app-3.0.0-beta5-SNAPSHOT-tests.jar

james-server-app-3.0.0-beta5-SNAPSHOT.jar

james-server-app-3.0.0-beta5-SNAPSHOT.war

maven-archiver

maven-shared-archive-resources

maven-status

supplemental-models.xml

test-classes

The archive files .tar.gz and .zip contain the binary build in the form you are used to seeing with beta4. The war file contains what should be a build for Tomcat/Jetty, etc. I haven't tried to deploy the war yet, but I am possibly interested in running it that way. 

Building with Eclipse is a little more complicated, but it also uses the Maven build system in the Eclipse IDE for Java Developers build.