Regular Java application pom.xml template

Last Modified: Sat, 10 Sep 2011 17:30:24 +0000 ; Created: Sat, 10 Sep 2011 17:30:24 +0000

Below is a template I use for regular Java application projects with Maven. Folder structure is typically as follows:

	pom.xml
	src/main/java/com/rodneybeede/...
	src/test/java/com/rodneybeede/...

<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>com.rodneybeede.groupid</groupId>
	<artifactId>project-codename</artifactId>
	<packaging>jar</packaging>
	<version>SNAPSHOT</version>

	<name>Project Name</name>
	<url>http://www.rodneybeede.com/</url>
	<inceptionYear>2011</inceptionYear>

	<licenses>
		<license>
			<name>GNU GENERAL PUBLIC LICENSE</name>
			<url>http://www.gnu.org/licenses/gpl-3.0.txt</url>
			<distribution>repo</distribution>
			<comments>GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007</comments>
		</license>
	</licenses>

	<organization>
		<name>rodneybeede.com</name>
		<url>http://www.rodneybeede.com/</url>
	</organization>

	<developers>
		<developer>
			<id>rbeede</id>
			<name>Rodney Beede</name>
			<email>nospam_contactme_no$pam@[email protected]</email>
			<url>http://www.rodneybeede.com/</url>
			<organization>rodneybeede.com</organization>
			<organizationUrl>http://www.rodneybeede.com/</organizationUrl>
			<roles>
				<role>architect</role>
				<role>developer</role>
				<role>tester</role>
			</roles>
			<timezone>-7</timezone>
		</developer>
	</developers>

	<dependencies>
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>1.2.16</version>
		</dependency>
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>apache-log4j-extras</artifactId>
			<version>1.0</version>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-eclipse-plugin</artifactId>
				<configuration>
					<downloadSources>true</downloadSources>
					<downloadJavadocs>true</downloadJavadocs>
				</configuration>
			</plugin>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.6</source>
					<target>1.6</target>
				</configuration>
			</plugin>
			<plugin>
				<artifactId>maven-assembly-plugin</artifactId>
				<version>2.2.1</version>
				<configuration>
					<descriptorRefs>
						<descriptorRef>jar-with-dependencies</descriptorRef>
					</descriptorRefs>
					<archive>
						<manifest>
							<mainClass>com.rodneybeede.groupid.Main</mainClass>
						</manifest>
					</archive>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<repositories>
		<repository>
			<id>javaNet2</id>
			<name>java.net Maven 2 Repository</name>
			<url>http://download.java.net/maven/2/</url>
			<layout>default</layout>
		</repository>
	</repositories>
</project>