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:
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:
<name>Sakai Maven Repo</name>
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.