Shale Dependency in Maven 2

Posted Sat, 10 Dec 2005

I mentioned in my post on Getting Started with Shale that I'd come back to using it with Maven. Since the project is so new, there's no Shale artifact in the Ibiblio repository. For the time being, you should install Shale into your local repository by hand. This will let you use Shale as a dependency in your applications managed by Maven the way you'd expect too.

The first step is to download the latest nightly build of Shale. You can find the nighly builds in their CVS repository.

Extract the bundle and go into the dist directory. You'll see 6 jar files that we'll install into your repository. In general, for each jar, executing:

mvn install:install-file 
      -DgroupId=<struts-shale> 
      -DartifactId=<jarname>
      -Dversion=<SNAPSHOT>
      -Dfile=<path-to-file>
      -Dpackaging=<jar> 
      -DgeneratePom=true

Will be sufficient, however, shale-core has several dependencies. It would be nice if listing shale-core as a dependency of your project automatically got you it's dependencies as well. To accomplish this, we'll create a simple POM for the shale-core artifact:

shale-core-SNAPSHOT.pom

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>struts-shale</groupId>
  <artifactId>shale-core</artifactId>
  <packaging>jar</packaging>
  <version>SNAPSHOT</version>
  <name>Struts Shale</name>
  <url>http://struts.apache.org</url>

  <dependencies>
        <dependency>
                <groupId>commons-beanutils</groupId>
                <artifactId>commons-beanutils</artifactId>
                <version>1.7.0</version>
        </dependency>

        <dependency>
                <groupId>commons-chain</groupId>
                <artifactId>commons-chain</artifactId>
                <version>1.0</version>
        </dependency>

        <dependency>
                <groupId>commons-digester</groupId>
                <artifactId>commons-digester</artifactId>
                <version>1.7</version>
        </dependency>

        <dependency>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
                <version>1.0.4</version>
        </dependency>

        <dependency>
                <groupId>commons-validator</groupId>
                <artifactId>commons-validator</artifactId>
                <version>1.2.0</version>
        </dependency>
  </dependencies>
</project>

Then install the jar with it's POM by executing:

mvn install:install-file 
      -DgroupId=<struts-shale> 
      -DartifactId=<jarname>
      -Dversion=<SNAPSHOT>
      -Dfile=<path-to-file>
      -Dpackaging=<jar> 
      -DgeneratePom=true
      -DpomFile=<path-to-pom>

NOTE: If you're using a Maven version before 2.0.1 SNAPSHOT, you'll need to copy the POM into your repository manually:

cp shale-core-SNAPSHOT.pom ~/m2/repository/struts-shale/shale-core/SNAPSHOT/

You can repeat this process every now and then with the latest nightly snapshot to keep current on Shale builds until the Ibiblio repository gets an artifact for it.

Related Books

Maven: The Definitive Guide The World Market for Woven Fabrics of Less Than 85% Polyester Staple Fibers by Weight, Mixed Mainly with Cotton, Not Exceeding 170 G/M2: A 2007 Global Trade Perspective The World Market for Bituminous Shale and Tar Sands: A 2007 Global Trade Perspective Maven: A Developer's Notebook (Developer's Notebooks) The World Market for Coated Paper and Paperboard Used for Writing and Printing with over 150 G/M2 and Less Than 10% by Weight of Fiber by Mechanical Process, ... or Sheets: A 2007 Global Trade Perspective

Post a Comment




About

My name is Tim Fanelli, I am a software engineer in Northern NY. I spend most of my time working, and when I can, I try to post interesting things here.

Cigar Dossiers