Dashboard > Terracotta Developer Documentation > ... > Development Process > Coding > Building Terracotta > Maven Migration
  Terracotta Developer Documentation Log In   View a printable version of the current page.  
  Maven Migration
Added by Jason Voegele, last edited by Eric Redmond on Jun 18, 2007  (view change)
Labels: 
(None)

Maven Migration Progress

It is now possible to do a full end-to-end compile of all the Terracotta source modules using Maven 2.

Initial Setup

Insert the following profile into your ~/.m2/settings.xml (if it doesn't exist, copy your $M2_HOME/conf/settings.xml to ~/.m2/settings.xml) file, replacing "jdk*.home" properties with your jdk 1.4 and 1.5 home directory paths:

<settings>
  ...
  <profiles>
    ...
    <profile>
      <id>tc-dev</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <jdk14.home>/System/Library/Frameworks/JavaVM.framework/Versions/1.4.2/Home</jdk14.home>
        <jdk15.home>/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home</jdk15.home>
      </properties>
    </profile>
    ...
  </profiles>
  ...
</settings>

You can ensure that the profile is working by typing:

mvn help:active-profiles

Compilation and Testing

To compile all of the source modules, use this command from the code/base directory:

mvn install -Dmaven.test.skip

You must use 'mvn install' instead of simply 'mvn compile' because of the way Maven handles the dependencies between the modules. The '-Dmaven.test.skip' is necessary because the standard Maven build lifecycle insists on having all tests execute and pass before it will install a module - yet test-jars must all be installed before tests pass. Once these artifacts exist in a central repository (or are set up in Eclipse to use Maven) this will be unnecessary.

Next, run a full build, complete with test cases:

mvn install -fn

The "-fn" flag tells Maven not to fail completely if a test case does not pass... naturally this should not be the case, but is a useful time saver.

Most dependencies are resolved automatically either from the Maven central repository or from Terracotta's own Maven repository.

The following dependencies cannot be resolved automatically because they cannot be legally redistributed via our Maven repository. You will have to manually download and install these dependencies according to the instructions given below.

1) javax.management:jmxri:jar:1.2.1

  Try downloading the file manually from:
      http://java.sun.com/products/JavaManagement/download.html

  Then, install it using the command:
      mvn install:install-file -DgroupId=javax.management -DartifactId=jmxri \
          -Dversion=1.2.1 -Dpackaging=jar -Dfile=/path/to/file

  Path to dependency:
        1) org.terracotta:common:jar:2.3-SNAPSHOT
        2) javax.management:jmxri:jar:1.2.1

2) com.sun.jdmk:jmxtools:jar:1.2.1

  Try downloading the file manually from:
      http://java.sun.com/products/JavaManagement/download.html

  Then, install it using the command:
      mvn install:install-file -DgroupId=com.sun.jdmk -DartifactId=jmxtools \
          -Dversion=1.2.1 -Dpackaging=jar -Dfile=/path/to/file

  Path to dependency:
        1) org.terracotta:common:jar:2.3-SNAPSHOT
        2) com.sun.jdmk:jmxtools:jar:1.2.1

3) javax.management:jmxremote:jar:1.0.1_04

  Try downloading the file manually from:
      http://java.sun.com/products/JavaManagement/download.html

  Then, install it using the command:
      mvn install:install-file -DgroupId=javax.management -DartifactId=jmxremote \
          -Dversion=1.0.1_04 -Dpackaging=jar -Dfile=/path/to/file

  Path to dependency:
        1) org.terracotta:management:jar:2.3-SNAPSHOT
        2) javax.management:jmxremote:jar:1.0.1_04

4) javax.management:jmxremote_optional:jar:1.0.1_04

  Try downloading the file manually from:
      http://java.sun.com/products/JavaManagement/download.html

  Then, install it using the command:
      mvn install:install-file -DgroupId=javax.management -DartifactId=jmxremote_optional \
          -Dversion=1.0.1_04 -Dpackaging=jar -Dfile=/path/to/file

  Path to dependency:
        1) org.terracotta:management:jar:2.3-SNAPSHOT
        2) javax.management:jmxremote_optional:jar:1.0.1_04

5) javax.transaction:jta:jar:1.0.1B

  Try downloading the file manually from:
      http://java.sun.com/products/jta

  Then, install it using the command:
      mvn install:install-file -DgroupId=javax.transaction -DartifactId=jta \
          -Dversion=1.0.1B -Dpackaging=jar -Dfile=/path/to/file

  Path to dependency:
        1) org.terracotta:legacy-test-tree:jar:2.3-SNAPSHOT
        2) org.springframework:spring-hibernate3:jar:2.0
        3) org.hibernate:hibernate:jar:3.2.0.cr4
        4) javax.transaction:jta:jar:1.0.1B

Roadmap

There are several things that must be accomplished before the Maven build system can completely replace the current JRuby-based build system. These include:

  • Compilation of AspectJ sources in the dso-spring-aj module
  • Integrating the creation of the boot JAR into the build process
  • Being able to run execute tests within web containers
  • Building JAR files for the config-bundles in the clustered-* modules
  • Convert Eclipse classpath to use Maven plugin

AspectJ Compilation

There is an AspectJ plugin for Maven 1.x. The AspectJ plugin for Maven 2 is not yet "official", but it should be sufficient for our purposes. It can be found here: http://mojo.codehaus.org/aspectj-maven-plugin/

Boot JAR

Several Terracotta source modules rely on the presence of the boot JAR to run tests. The Maven build process will have to ensure that the boot JAR is created and made available to these modules when executing tests. This should be fairly easy to accomplish by using the Maven exec plugin to call the BootJarTool to create the boot JAR - I haven't looks much into this, however, the assembly plugin seems the better course.

Note that several tests still fail because of this missing piece, especially the modules under parent15... the failing poms are marked as such.

Convert Eclipse classpath to use Maven plugin

Trivial to do, just a case of installing the Eclipse plugin. I'm holding off on this until the next release of the Eclipse plugin - since a couple bugs make it unworkable (well, it can work, just not as seemless as it should be).

Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.5 Build:#811 Jul 25, 2007) - Bug/feature request - Contact Administrators