Binary deployment of Sakai

If you ever use the cafe version of Sakai, you’ll know that if you want to add another tool into the mix, you often need to bring in half a dozen other projects just to get it to build because the dependencies were so interwined with each other, aka Dependency Hell. That is all beginning to change with the rationalisation of many dependencies into ‘mini-kernel’ type packages of common functionality so that we have fewer distributed services hanging around, and more pluggable modules.

We are also now seeing binary deployment of projects. Up until now, if you wanted to add a contrib project into your build you would have to check it out of SVN, resolve any dependencies for it, read up on any POMs you may need to change to get it to build in your environment, issue a maven clean install and see what happened. To the battle hardened Sakai developer, relatively painless but nonetheless a bit more involved than it need be.

Enter binary deployment. Using this, you never need to even look at the source, let alone check it out and build it. So long as the artifact has been assembled and added to the repository, you can add a few simple lines to a POM and get it to automatically download and deploy the project. Better yet, using a build profile, you can have complete control what tools get deployed. Here’s how:

Let’s say I want to add SiteStats to my build. Luckily, some savvy developer has already generated the artifact and added it to the Maven repo. I first created a separate POM that tracks all of these additional tools and I include that as a module to build in my base Sakai POM, then just add this to the custom POM to add the SiteStats binary:

<profile>
<id>sitestats</id>
<properties>
<clean.targets>
components/sitestats-component
</clean.targets>
<deploy.target>tomcat-overlay</deploy.target>
</properties>
<dependencies>
<dependency>
<groupId>org.sakaiproject.sitestats</groupId>
<artifactId>sitestats-assembly</artifactId>
<version>2.1-SNAPSHOT</version>
<classifier>tomcat-overlay</classifier>
<type>zip</type>
</dependency>
</dependencies>
</profile>

Then issue the build via:
mvn clean install sakai:deploy -Psitestats

and through the power of Maven voodoo (and the Assembly Plugin), the dependencies are downloaded from the repository as a Tomcat overlay, installed into your local repo, then deployed into Tomcat. Double up on the profile block for another binary tool and you can install that one as well:

mvn clean install sakai:deploy -Psitestats,otherone<

For this example you’ll need to make sure you have the snapshots repo added either to your master Sakai POM, or locally. Trunk and the maintenance branch of 2.6.x have this already, for tagged released (ie 2.6.0) adjust the master POM so that snapshots are enabled:

<repositories>

<repository>
<id>sakai-maven2-snapshots</id>
<name>Sakai Maven Repo</name>
<layout>default</layout>
<url>http://source.sakaiproject.org/maven2-snapshots</url&gt;
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>

</repositories>

This isn’t new, the Kernel has been using binary deployment for a while, but with the proliferation into other tools and contrib projects, the life of the Sakai developer is certainly going to be easier.

Much kudos to Anthony Whyte for creating and adding the core-deploy POM to trunk, David Horwitz for the assembly work, and Nuno Fernandes for porting SiteStats to Wicket!

Next up, how to get your own project ready for binary deployment using the Maven Assembly Plugin.

Advertisements

One thought on “Binary deployment of Sakai

  1. Steve, this is great stuff. I think that getting to a binary distribution is a necessary step to scaling up the community. A requirement to compile everything from source for every install is very much a rate limiting factor. I too am impressed with David, Anthony, Nuno, you, and others who are leading us in this direction – one step at a time.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s