Building a POM

Revision as of 08:04, 18 March 2016 by Hinerm (talk | contribs) (Initial version)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

When you start a new Maven project, one of the first things you will do is create an appropriate pom.xml. The POM determines what resources are available to your project. Given the scope of the ImageJ project, there are several possible starting points. The purpose of this guide is to help you select a pom.xml based on your individual project's goals.


Using ImageJ

<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>net.imagej</groupId>
		<artifactId>pom-imagej</artifactId>
		<version>14.8.0</version>
		<relativePath />
	</parent>

	<artifactId>my-project</artifactId>
	<version>0.1.0-SNAPSHOT</version>

<!-- TODO: Fill out these sections -->
	<name></name>
	<description></description>

	<developers>
		<developer>
			<id></id>
			<name></name>
			<email></email>
			<url>r</url>
			<organization></organization>
			<organizationUrl></organizationUrl>
			<roles>
				<role>founder</role>
				<role>lead</role>
				<role>developer</role>
				<role>debugger</role>
				<role>reviewer</role>
				<role>support</role>
				<role>maintainer</role>
			</roles>
			<timezone>-6</timezone>
		</developer>
	</developers>
	<contributors>
		<!--
		NB: Need a least one element to override the parent.
		See: https://issues.apache.org/jira/browse/MNG-5220
		-->
		<contributor><name>None</name></contributor>
	</contributors>

<!-- TODO: See Optional Dependencies section -->
	<dependencies>
		<!-- ImageJ dependencies -->
		<dependency>
			<groupId>net.imagej</groupId>
			<artifactId>imagej</artifactId>
		</dependency>

		<!-- Test dependencies -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>


	<repositories>
		<!-- NB: for project parent, in case of partial checkout -->
		<repository>
			<id>imagej.public</id>
			<url>http://maven.imagej.net/content/groups/public</url>
		</repository>
	</repositories>
</project>

Optional dependencies

Simply copy and paste any or all of these into your POM's <dependency> block to add the indicated functionality.


<!-- User-facing commands -->
<dependency>
	<groupId>net.imagej</groupId>
	<artifactId>imagej-plugins-commands</artifactId>
</dependency>

<!-- Run graphically with the classic (ImageJ 1.x) user interface -->
<dependency>
	<groupId>net.imagej</groupId>
	<artifactId>imagej-legacy</artifactId>
</dependency>

<!-- Run graphically with the ImageJ2 user interface-->
<dependency>
	<groupId>net.imagej</groupId>
	<artifactId>imagej-ui-swing</artifactId>
</dependency>