3. Build and Deploy

Sakai uses Apache's Maven build tool to compile and deploy its modules.

How Sakai uses Maven

The steps below are limited to what you need to get started, but you may feel the need to learn more about how Sakai uses Maven. To find the most detailed such documentation, look for sakai_maven.doc in reference/docs/architecture of the source archive or on subversion at: https://source.sakaiproject.org/svn/reference/tags/sakai_2-3-1/docs/architecture/sakai_maven.doc

3.1. Download Source

If you haven't yet, download the Source archive from http://www.sakaiproject.org/release

Getting the Code from Subversion

Alternatively, you may check out the source code from subversion. You might wish to do this, for example, in order to grab the maintenance branch, which will include the latest set of bug fixes. To check out the maintenance branch, you can use the following command:

svn export https://source.sakaiproject.org/svn/sakai/branches/sakai_2-3-x/

In which case you could skip the unpacking step below, and your root directory would be sakai_2-3-x instead of sakai-src.

3.2. Unpack Source

Choose a location to unpack the Sakai source (your home directory is fine), and when you unpack it you will see a directory named sakai-src.

3.3. Run Maven

From within the sakai-src directory, run the command maven bld dpl.

Subsequent builds

Subsequent builds would be advised to add the "clean" phase by using the command maven cln bld dpl, or the equivalent shortcut: maven sakai. See the sakai_maven.doc for more details.

This will run for quite a few minutes with fairly verbose output, particularly when it's your first build. Maven will download any dependencies into the local repository, compile the Sakai code, and then deploy Sakai to Tomcat in the form of .war files in the $CATALINA_HOME/webapps directory. If Maven completes with the message BUILD SUCCESSFUL, you should be able to move on to the next step. If you are greeted with the report BUILD FAILED read the accompanying error message carefully to troubleshoot (see the Troubleshooting section).

Maven and Memory

You may find that your machine runs out of memory while it is building Sakai. As it turns out, maven does not read JAVA_OPTS when it starts up, and so if your build output complains of "Out of Memory" errors you'll need to set an additional environment variable, namely, MAVEN_OPTS. The value in the sample Unix command below should be more than enough:

export MAVEN_OPTS="-Xmx384m -XX:PermSize=48m"

You will probably be able to start up Tomcat and run Sakai with the default configuration at this point, but it would be better to take care of some basic post-installation configuration first.