POM Example

Here is a minimal POM (project.xml) file:

 	<project>
	  <pomVersion>3</pomVersion>
	  <id>dist-name</id>
	  <currentVersion>1.0</currentVersion>
	  <groupId>repo-folder</groupId>
	  <dependencies>
	    <dependency>
	      <artifactId>servletapi</artifactId>
	      <groupId>servletapi</groupId>
	      <version>2.3</version>
	    </dependency>
	    <dependency>
	      <id>javagen+commons</id>
	      <version>1.0</version>
	    </dependency>
	    <dependency>
	      <id>j2ee</id>
	      <version>1.3.1</version>
	      <url>http://java.sun.com/j2ee/sdk_1.3/</url>
	    </dependency>
	    <dependency>
	      <artifactId>standard</artifactId>
	      <groupId>taglibs</groupId>
	      <version>1.0.4</version>
	      <properties>
	        <war.bundle>true</war.bundle>
	      </properties>
	    </dependency>
	    <dependency>
	      <artifactId>c</artifactId>
	      <groupId>taglibs</groupId>
	      <version>1.0.4</version>
	      <type>tld</type>
	    </dependency>
	  </dependencies>
	  <build>
	    <sourceDirectory>src/java</sourceDirectory>
	    <integrationUnitTestSourceDirectory>src/test-cactus</integrationUnitTestSourceDirectory>
	    <resources>
	      <resource>
	        <directory>src/resources</directory>
	      </resource>
	      <resource>
	        <directory>src/java</directory>
	        <excludes>
	          <exclude>**/*.java</exclude>
	        </excludes>
  	    </resource>
	    </resources>
	  </build>
	</project>

The first few values (groupId, id, currentVersion) are set in props-maven.xml to their JAM equivalents.

The dependency list is used to build the classpath and other distribution targets and properties. There are a few variations in specifying these elements that are worth discussing. The simplest form is to specify the artifactId, version and groupId tags which represent the jar name prefix, suffix, and relative repository subdirectory respectively. Using this information JAM will expect to find the servletapi library in the repository under: servletapi/jars/servletapi-1.0.jar. The next dependency, javagen+commons uses the deprecated (but still common) id tag, which is short for (note the plus sign):

<artifactId>javagen-commons</artifactId> 
<groupId>javagen</groupId> 
The j2ee dependency resolves to the j2ee/jars/j2ee-1.3.1.jar library, but with one small problem: due to license restrictions, this file is not stored in Maven's central repository. Thats where the url tag comes in: you have to follow this link to Sun's web site, download the J2EE 1.3.1 distribution, extract the j2ee.jar file, copy it into the repository manually and rename it to match Maven conventions. The next dependency, standard resolves to taglibs/jars/standard-1.0.4.jar. As you might have guessed, the war.bundle tag indicates that this library should be bundled into the war distribution file. The last dependency, c resolves to taglibs/tlds/c-1.0.4.tld. Normally the type tag defaults to jar, but in this case we are working with a JSP tag library descriptor file, so both the sub-directory (formed by the plural of the type tag) and file extension are changed to tld. To see an extensive example of a POM file, look in the JAM install sub-directory. This file lists all the open-source libraries placed in the local repository when you install JAM, as well as the naming conventions used with each product.

The build section starts off defining directories for Java source and integration tests source. The remainder of this section specifies what non-source resources to include in the final distribution.

For a complete description of the POM components see: http://maven.apache.org/reference/project-descriptor.html