May 2005
[ vmassol ] 15:26, Monday, 23 May 2005

In preparation for the launch of Maven: A Developer's Notebook, Tim and I have created the Mavenbook.org web site. By using it you'll be able to track the progress of the book but more importantly it'll allow you to download the book's source code, get additional samples, read tips and tricks on using Maven, etc. All of this through a blog interface.

BTW, we're not web designers so we've used a skin found on OSWD. I really like this web site which has both free skins and premium ones.

Last, the icing on the cake, the web site has been done using XWiki. Yeah, you heard it right, there is a wiki under the hood, which allow us to easily edit any page online. Each news item is actually a wiki page to which we have associated an Article object. The home page has a simple macro that does a search for all pages with articles and matching some criteria. Cool, no?

Maven: A Developer's Notebook

Enjoy!

[ vmassol ] 10:48, Sunday, 1 May 2005

Cargo 0.5 has been released yesterday. One novelty is the Maven plugin. You can now start and stop a variety of containers using this plugin. This should come very handy for all of you wishing to perform integration or functional testing with Maven. The containers that are currently supported are: Resin 2.x, Resin 3.x, Tomcat 3.x, Tomcat 4.x, Tomcat 5.x, Orion 1.x, Orion 2.x, Jetty 4.x, jo! 1.x, OC4J 9.x and WebLogic 8.x.

For example, imagine that you have some integration tests in your project's test directory and that you need, say, Tomcat 5.0.30 to run them. You'll need to start the Tomcat container before the test:test goal kicks in. Do this by writing a preGoal in your maven.xml :

<preGoal name="test:test"> <ant:mkdir dir="${maven.build.dir}/tomcat"/> <attainGoal name="cargo:start"/> </preGoal>

You'll need to provide Cargo configuration data in your project.properties or build.properties file. For example a minimal configuration would be:

cargo.containers = tomcat
cargo.container.tomcat.containerKey = tomcat5x
cargo.container.tomcat.homeDir = C:/apps/tomcat-5.0.30
cargo.container.tomcat.config.hint = standalone
cargo.container.tomcat.config.dir = ${maven.build.dir}/tomcat
cargo.container.tomcat.config.standalone.servlet.port = 8180

Alternatively you can ask the plugin to automatically download and install Tomcat for you (it'll download it only once), by specifying:

cargo.containers = tomcat
cargo.container.tomcat.containerKey = tomcat5x

cargo.zipUrlInstaller.tomcatinstaller.installUrl = http://www.apache.org/dist/jakarta/tomcat-5/v5.0.30/bin/jakarta-tomcat-5.0.30.zip
cargo.zipUrlInstaller.tomcatinstaller.installDir = ${maven.build.dir}/installs
cargo.container.tomcat.zipUrlInstaller = tomcatinstaller

cargo.container.tomcat.config.hint = standalone
cargo.container.tomcat.config.dir = ${maven.build.dir}/tomcat
cargo.container.tomcat.config.standalone.servlet.port = 8180

As you may have noticed, in our example above we've reused the existing Maven Test plugin which looks for test sources in ${pom.build.unitTestSourceDirectory} . With this strategy you'll need to create a separate subproject for running your integration/functional tests in order not to interfere with pure unit tests that you may already have in ${pom.build.unitTestSourceDirectory} .

If there's a strong demand, we may consider adding a cargo:test goal in the future that you look for tests in, say, src/test/cargo by default (leaving src/test/java for unit tests).

Please note that there's also an alternative which is to start the Container directly from your unit tests.

If you find Cargo interesting, please come and help us on the Cargo mailing lists. There are lots of different ways you can help: trying Cargo on containers, implementing new containers (for example, JBoss, JOnas, WebSphere, etc), discussing new ideas, letting us know what new features you'd love to see, etc.

[ vmassol ] 10:36, Sunday, 1 May 2005

The Cargo team is pleased to announce the release of Cargo 0.5.

The major changes from Cargo 0.4 to 0.5 are:

  • New Maven plugin
  • Added support for hot deployments
  • Added support for the jo! container

Detailed release notes are available on the download page.

Here's an example of how to use Cargo from Java:

Container container = new Resin3xContainer();
container.setHomeDir("c:/apps/resin-3.0.8");

Deployable war = container.getDeployableFactory().createWAR("path/to/simple.war");
container.getConfiguration().addDeployable(war);

container.start();
// Here you are assured the container is started.

container.stop();
// Here you are assured the container is stopped.

Here's an example using the provided Ant tasks:

<cargo-orion2x homeDir="c:/apps/orion-2.0.3" output="target/output.log" log="target/cargo.log" action="start"> <configuration> <property name="cargo.servlet.port" value="8180"/> <war warfile="path/to/my/simple.war"/> <ear earfile="path/to/my/simple.ear"/> </configuration> </cargo-orion2x>

And here's an example using the Maven plugin:

// To run it:
maven cargo:start

// To configure it, add the following in a Maven properties file:
cargo.containers = myTomcat
cargo.container.myTomcat.containerKey = tomcat5x
cargo.container.myTomcat.homeDir = c:/apps/jakarta-tomcat-5.0.30
cargo.container.myTomcat.config.hint = standalone
cargo.container.myTomcat.config.dir = ${maven.build.dir}/myTomcat/config
cargo.container.myTomcat.config.standalone.servlet.port = 8180

Enjoy!