Call us: +1-415-738-4000

Working with Apache Maven

Apache Maven users can set up the Terracotta repository for Terracotta artifacts (including Ehcache, Quartz, and other Terracotta projects) using the URL shown:

<repository>
    <id>terracotta-repository</id>
    <url>http://www.terracotta.org/download/reflector/releases</url>
    <releases>
        <enabled>true</enabled>
    </releases>
</repository>

A complete repository list is given below. Note the following when using Maven:

  • The repository URL is not browsable.
  • If you intend to work with Terracotta SNAPSHOT projects (usually in trunk), see Working With Terracotta SNAPSHOT Projects.
  • You can use the artifact versions in a specific kit when configuring a POM. Artifacts in a specific kit are guaranteed to be compatible.
NOTE: Errors Caused by Outdated Dependencies
Certain frameworks, including Hibernate and certain Spring modules, may have POMs with dependencies on outdated versions of Terracotta products. This can cause older versions of Terracotta products to be installed in your application's classpath ahead of the current versions of those products, resulting in NoClassDefFound, NoSuchMethod, and other errors. At best, your application may run but not perform correctly. Be sure to locate and remove any outdated dependencies before running Maven.

Creating Enterprise Edition Clients

The following example shows the dependencies needed for creating Terracotta 4.0.1 clients. Version numbers can be found in the specific Terracotta kit you are installing. Be sure to update all artifactIds and versions to match those found in your kit.

<dependencies>
 <!-- The Terracotta Toolkit is required for running a client. -->
 <dependency>
   <groupId>org.terracotta</groupId>
   <artifactId>terracotta-toolkit-runtime-ee</artifactId>
   <version>4.0.1</version>
 </dependency>

   <!-- The following dependencies are required for using Ehcache. 
        Dependencies not listed here include the SLF4J API JAR (version 1.6.1) and an SLF4J
    binding JAR of your choice. These JARs specify the required logging framework. 
    It also does not include the explicit-locking JAR.-->
 <dependency>
   <groupId>net.sf.ehcache</groupId>
   <artifactId>ehcache-ee</artifactId>
   <version>2.7.1</version>
 </dependency>

<!-- The following dependencies are required for using Terracotta Sessions. -->
 <dependency>
   <groupId>org.terracotta</groupId>
   <artifactId>web-sessions</artifactId>
   <version>4.0.0</version>
 </dependency>
</dependencies>

Using the tc-maven Plugin

The tc-maven plugin can simplify the process of integrating and testing Terracotta products and other assets. The plugin supplies a number of useful tasks, including starting, stopping, and pausing Terracotta servers. To integrate the plugin, add the following to your project's POM (version shown is for Terracotta 3.7.4):

<plugin>
 <groupId>org.terracotta.maven.plugins</groupId>
 <artifactId>tc-maven-plugin</artifactId>
 <version>1.9.4</version>
</plugin>

The following is an abbreviated list of goals available with the tc-maven plugin:

GoalFunction
tc:help Print help.
tc:start Start the Terracotta server.
tc:stop Stop the Terracotta server.
tc:restart Restart the Terracotta server.
tc:dev-console Start the Terracotta Developer Console.
tc:run Start multiple Terracotta server and client processes.
tc:clean Clean Terracotta data and logs directories.
tc:terminate Stop web servers that started with tc:run.

Execute tc:help to print more detailed information on these goals.

Working With Terracotta SNAPSHOT Projects

If you intend to work with Terracotta SNAPSHOT projects (usually in trunk), you must have the following settings.xml file installed:

<settings xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
    http://maven.apache.org/xsd/settings-1.0.0.xsd">
 <profiles>
   <profile>
     <id>terracotta-repositories</id>
     <repositories>
       <repository>
         <id>terracotta-snapshots</id>
         <url>http://www.terracotta.org/download/reflector/snapshots</url>
       </repository>
     </repositories>
     <pluginRepositories>
       <pluginRepository>
         <id>terracotta-snapshots</id>
         <url>http://www.terracotta.org/download/reflector/snapshots</url>
       </pluginRepository>
     </pluginRepositories>
   </profile>
 </profiles>
 <activeProfiles>
 <activeProfile>terracotta-repositories</activeProfile>
 </activeProfiles>
</settings>

Terracotta Repositories

The following contains all of the Terracotta repositories available:

<repositories>
 <repository>
   <id>terracotta-snapshots</id>
   <url>http://www.terracotta.org/download/reflector/snapshots</url>
   <releases><enabled>false</enabled></releases>
   <snapshots><enabled>true</enabled></snapshots>
 </repository>
 <repository>
   <id>terracotta-releases</id>
   <url>http://www.terracotta.org/download/reflector/releases</url>
   <releases><enabled>true</enabled></releases>
   <snapshots><enabled>false</enabled></snapshots>
 </repository>
</repositories>
<pluginRepositories>
 <pluginRepository>
   <id>terracotta-snapshots</id>
   <url>http://www.terracotta.org/download/reflector/snapshots</url>
   <releases><enabled>false</enabled></releases>
   <snapshots><enabled>true</enabled></snapshots>
 </pluginRepository>
 <pluginRepository>
   <id>terracotta-releases</id>
   <url>http://www.terracotta.org/download/reflector/releases</url>
   <releases><enabled>true</enabled></releases>
   <snapshots><enabled>false</enabled></snapshots>
 </pluginRepository>
</pluginRepositories>