Monday, August 27, 2007

Maven integration for Terracotta - First days

I've been working on Terracotta for a long time. What I've noticed is that every few months some improvement comes a long that makes a big difference. Maven integration, while external to the core of the product, is one of those game changing improvements. It is now possible to build, run, and test Terracotta enabled software in a completely automated fashion. Big thanks to Eugene on doing such a good job making this happen and Jason and Juris for getting it deployed and helping get stuff integrated.

The first thing one should do when going off and trying to use this stuff is to check out the Wiki page that covers the latest greatest. At the time of this blog one can:
  • Start/Stop a Terracotta Server
    • mvn tc:start
    • mvn tc:stop
  • Run an app that uses Terracotta
    • mvn tc:run
    • In the plugin section add some configuration describing the class and number of nodes you want run to make that work.
    • some example poms exist in the source of the plugin as well:
      • svn co http://svn.terracotta.org/svn/tc/maven-plugin/trunk/
      • example in maven-tc-plugin/examples/tc-maven-plugin-sample
  • Run Tests using surefire
    • mvn tc:test
    • Similar to tc:run but with test classes instead of just mains
    • Examples of this are also in the above checkout in the maven-tc-plugin/examples/tc-maven-sample-surefire directory
  • Build boot jars
    • mvn tc:bootjar
  • Auto-download all dependencies
  • Auto-download config modules specified in your tc-config.xml
Checkout this pom.xml I'm using for a little project I whipped up the other day. It downloads the Terracotta maven plugin, all dependent jars, and even the config modules used by this app and then runs it. One can do this with no Terracotta code pre-installed on the machine. This drastically simplifies deploying, testing and running with Terracotta. We will be adding Cargo support as well so this will be extended to container apps.

Currently we are just using this for nightly snapshots. We'll be adding the ability to get finals in the next final release. Give it a try. It's really fun stuff.

UPDATE: Someone pointed out that this doesn't have much detail. It's a good point I added a little bit more but it does LINK to details. The pom.xml link is a good example pom and the wiki link has a bunch of details.

0 comments: