Saturday, June 20, 2009

Terracotta Integration Module with Maven

TIMs or Terracotta Integration Module is a way to package classes and configuration for certain interfaces and products so that you can add terracotta clustering without much effort. For example, we have a TIM for ehcache so that anyone who uses ehcache can get terracotta clustering just by including the TIM http://forge.terracotta.org/releases/projects/tim-ehcache/

Sometimes using archetypes in maven is a bit unweilding, so first we are going to check out the correct versions and make sure everything is in place.

Let's check out the maven-archetype-plugin first:


svn co http://svn.apache.org/repos/asf/maven/archetype/tags/maven-archetype-2.0-alpha-4/ maven-archetype-2.0-alpha-4
cd maven-archetype-2.0-alpha-4
mvn clean install


Now we want to checkout and install the tim-archetype plugin, is is what builds the directory structure and configuration for our TIM project.


svn co http://svn.terracotta.org/svn/forge/projects/tim-archetype/trunk/ tim-archetype
cd tim-archetype
mvn clean install


To create a TIM project you need to run the following command:


mvn org.apache.maven.plugins:maven-archetype-plugin:2.0-alpha-4:generate \
-DarchetypeGroupId=org.terracotta.maven.archetypes \
-DarchetypeArtifactId=tim-archetype \
-DarchetypeVersion=1.5.0-SNAPSHOT \
-DremoteRepositories=http://www.terracotta.org/download/reflector/maven2 \
-DgroupId=org.terracotta.modules.memcached \
-DartifactId=tim-memcached \
-Dversion=1.0.0



this will prompt you to run the following command:


[INFO] Using property: groupId = org.terracotta.modules.memcached
[INFO] Using property: artifactId = tim-memcached
[INFO] Using property: version = 1.0.0
Define value for property 'package': org.terracotta.modules.memcached.tim-memcached: :


Hit enter or type in the package name you desire and hit enter.


Define value for property 'package': org.terracotta.modules.memcached.tim-memcached: :
Confirm properties configuration:
groupId: org.terracotta.modules.memcached
artifactId: tim-memcached
version: 1.0.0
package: org.terracotta.modules.memcached.tim-memcached
Y: :


Type in 'Y' to finish creating a newly minted TIM.

All set to go!

2 comments:

Unknown said...

use http://repo2.maven.org/maven2/org/apache/maven/plugins/maven-archetype-plugin/2.0-alpha-4/

instead of

http://repo2.maven.org/maven2/org/apache/maven/plugins/maven-archetype-plugin/2.0-alpha-4/

alpha-5 doesn't work

Unknown said...

Thanks, Ill change it on the post