This site hosts historical documentation. Visit www.terracotta.org for recent product information.

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.
  • Coordinates for specific artifacts can be found by running tim-get with the info command:
UNIX/LINUX
${TERRACOTTA_HOME}/bin/tim-get.sh info <name of artifact>
MICROSOFT WINDOWS
%TERRACOTTA_HOME%\bin\tim-get.bat info <name of artifact>

You can generate a complete list of artifacts by running tim-get with the list command:

UNIX/LINUX
${TERRACOTTA_HOME}/bin/tim-get.sh list
MICROSOFT WINDOWS
%TERRACOTTA_HOME%\bin\tim-get.bat list
  • 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 3.4.0 ee clients, not clients based on the current Terracotta kit. 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. 
        The API version for this Toolkit is 1.1. -->
 <dependency>
   <groupId>org.terracotta</groupId>
   <artifactId>terracotta-toolkit-1.1-runtime-ee</artifactId>
   <version>2.0.0</version>
 </dependency>

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

<!-- The following dependencies are required for using Quartz Scheduler. -->
 <dependency>
   <groupId>org.quartz</groupId>
   <artifactId>quartz</artifactId>
   <version>1.8.4</version>
 </dependency>
 <dependency>
   <groupId>org.quartz</groupId>
   <artifactId>quartz-terracotta</artifactId>
   <version>1.2.1</version>
 </dependency>

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

Open-source clients can be created using non-ee artifacts.

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:

<plugin>
 <groupId>org.terracotta.maven.plugins</groupId>
 <artifactId>tc-maven-plugin</artifactId>
 <version>1.6.1</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.

If you are using the tc-maven plugin with an ee kit, you must have the terracotta-ee-<version>.jar file in your project. This JAR file is not available form a public repository. You must obtain it from your Terracotta representative and install it to your local repository. For example, to install version 3.5.2 of this JAR file:

mvn install:install-file -Dfile=terracotta-ee-3.5.2.jar \
  -DpomFile=terracotta-ee-3.5.2.pom -Dpackaging=jar -Dversion=3.5.2

This command format assumes that the JAR and POM files are available in the local directory. If they are not, you must provide the files' paths as well.

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>