Maven: Running faster setup

This document describes an alternative for the basic build-run-compile steps Jive recommends when using the Maven build.

Asumptions

This document assumes that you have followed instruction at Maven: Starting, Maven: Installing, and Maven: Creating new project.

Alternative

A traditional starup is described in Maven: Running Clearspace.

Faster startup

With the standard execute command disabling web services via the following commandline option can improve startup time if they are not needed:

-Djive.ws.disabled=true

All together:

mvn -Dcargo.wait=true -Djive.ws.disabled=true -P int integration-test

This does the following:

  1. Compile
  2. Run unit tests
  3. Package the war
  4. Deploy the war to Tomcat
  5. Start the Selenium Server
  6. Startup Tomcat

That's works great for when you're developing against your web module. But what about when you're working on a plugin? It kind of sucks to have to build the plugin, then to have to re-build and re-deploy the webapp when there hasn't been any webapp changes.

So, here's an improvement:

mvn -Dcargo.wait=true -Djive.ws.disabled=true -P int cargo:start

This does the following:

  • Startup Tomcat w/ whatever deployables have been previously built

This reduces the build-time.

Running Plugins

The way to run your plugins now (as of 2.5.3) is to pass the location of them into cargo from the commandline (or from the cargo script in the ./web/ directory.

For example, say your project has one plugin, "twitter".   You would invoke cargo like so:

mvn -DpluginDirs=/path/to/twitter/target/twitter   -DskipTests=true -Dcargo.wait=true -P int integration-test

If you want to run multiple plugins, the value of pluginDirs may be comma-delimited.

If you're on 2.5.3 or below, or things aren't working, check the ./web/pom.xml to be sure that <pluginDirs>${pluginDirs}</pluginDirs> in the cargo configuration isn't commented out or missing.  It would look like this:

<build>     
<plugins>         
<plugin>             
<groupId>org.codehaus.cargo</groupId>             
<artifactId>cargo-maven2-plugin</artifactId>             
<version>0.3-SNAPSHOT</version>             
<configuration>                 
<wait>${cargo.wait}</wait>                 
<container>                     
<containerId>tomcat5x</containerId>                     
<home>${tomcat6.home}</home>                         
<systemProperties>                             
 <jiveHome>\${basedir}/../target/jiveHome</jiveHome>   
 <jive.ws.disabled>true</jive.ws.disabled>                             
 <jive.devMode>true</jive.devMode>                             
 <pluginDirs>${pluginDirs}</pluginDirs>                         
</systemProperties>

The compile-run step would be:

  1. Compile your plugin from ./twitter/ with mvn install
  2. Run the above command, making sure -DpluginDirs has been set.