Difference between revisions of "Building a POM"

(Update to unified pom-scijava 12.0.0 parent)
Line 1: Line 1:
{{Development | tutorials}}
+
{{Development | tutorials}}When you start a new [[Maven]] project, one of the first things you will do is create an appropriate [https://maven.apache.org/pom.html 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.
 
 
When you start a new [[Maven]] project, one of the first things you will do is create an appropriate [https://maven.apache.org/pom.html 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 =
 
= Using ImageJ =
Line 8: Line 6:
 
<?xml version="1.0" encoding="UTF-8"?>
 
<?xml version="1.0" encoding="UTF-8"?>
 
<project xmlns="http://maven.apache.org/POM/4.0.0"
 
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
http://maven.apache.org/xsd/maven-4.0.0.xsd">
 
<modelVersion>4.0.0</modelVersion>
 
<modelVersion>4.0.0</modelVersion>
  
 
<parent>
 
<parent>
<groupId>net.imagej</groupId>
+
<groupId>org.scijava</groupId>
<artifactId>pom-imagej</artifactId>
+
<artifactId>pom-scijava</artifactId>
<version>14.8.0</version>
+
<version>12.0.0</version>
 
<relativePath />
 
<relativePath />
 
</parent>
 
</parent>
  
<artifactId>my-project</artifactId>
+
<groupId>[MY-GROUP-ID]</groupId>
 +
<artifactId>[MY-ARTIFACT-ID]</artifactId>
 
<version>0.1.0-SNAPSHOT</version>
 
<version>0.1.0-SNAPSHOT</version>
  
<!-- TODO: Fill out these sections -->
+
<name>[MY-PROJECT]</name>
<name></name>
+
<description>[MY-DESCRIPTION]</description>
<description></description>
+
<url>https://github.com/[MY-ORG]/[MY-REPO]</url>
 +
<inceptionYear>[MY-PROJECT'S-FIRST-YEAR]</inceptionYear>
 +
<organization>
 +
<name>[MY-ORGANIZATION-NAME]</name>
 +
<url>[MY-ORGANIZATION-WEB-SITE]</url>
 +
</organization>
 +
<licenses>
 +
<license>
 +
<name>CC0 1.0 Universal License</name>
 +
<url>http://creativecommons.org/publicdomain/zero/1.0/</url>
 +
<distribution>repo</distribution>
 +
</license>
 +
</licenses>
  
 
<developers>
 
<developers>
 
<developer>
 
<developer>
<id></id>
+
<id>[MY-GITHUB-ID]</id>
<name></name>
+
<name>[MY-FULL-NAME]</name>
<email></email>
+
<url>https://imagej.net/User:[MY-IMAGEJ-WIKI-ACCOUNT]</url>
<url>r</url>
 
<organization></organization>
 
<organizationUrl></organizationUrl>
 
 
<roles>
 
<roles>
 +
<!-- see https://imagej.net/Team -->
 
<role>founder</role>
 
<role>founder</role>
 
<role>lead</role>
 
<role>lead</role>
Line 44: Line 53:
 
<role>maintainer</role>
 
<role>maintainer</role>
 
</roles>
 
</roles>
<timezone>-6</timezone>
 
 
</developer>
 
</developer>
 
</developers>
 
</developers>
 
<contributors>
 
<contributors>
<!--
+
<contributor>
NB: Need a least one element to override the parent.
+
<name>None</name>
See: https://issues.apache.org/jira/browse/MNG-5220
+
</contributor>
-->
 
<contributor><name>None</name></contributor>
 
 
</contributors>
 
</contributors>
  
<!-- TODO: See Optional Dependencies section -->
+
<mailingLists>
 +
<mailingList>
 +
<name>ImageJ Forum</name>
 +
<archive>http://forum.imagej.net/</archive>
 +
</mailingList>
 +
</mailingLists>
 +
 
 +
<scm>
 +
<connection>scm:git:git://github.com/[MY-ORG]/[MY-REPO]</connection>
 +
<developerConnection>scm:git:git@github.com:[MY-ORG]/[MY-REPO]</developerConnection>
 +
<tag>HEAD</tag>
 +
<url>https://github.com/[MY-ORG]/[MY-REPO]</url>
 +
</scm>
 +
<issueManagement>
 +
<system>GitHub Issues</system>
 +
<url>http://github.com/[MY-ORG]/[MY-REPO]/issues</url>
 +
</issueManagement>
 +
<ciManagement>
 +
<system>None</system>
 +
</ciManagement>
 +
 
 +
<properties>
 +
<main-class>[MY-MAIN-CLASS-INCLUDING-PACKAGE]</main-class>
 +
<package-name>[MY-PACKAGE-PREFIX]</package-name>
 +
<license.licenseName>cc0</license.licenseName>
 +
<license.copyrightOwners>N/A</license.copyrightOwners>
 +
</properties>
 +
 
 +
<repositories>
 +
<repository>
 +
<id>imagej.public</id>
 +
<url>http://maven.imagej.net/content/groups/public</url>
 +
</repository>
 +
</repositories>
 +
 
 
<dependencies>
 
<dependencies>
 
<!-- ImageJ dependencies -->
 
<!-- ImageJ dependencies -->
Line 70: Line 110:
 
</dependency>
 
</dependency>
 
</dependencies>
 
</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>
 
</project>
 
</source>
 
</source>
 +
 +
* Replace the <code>[MY-...]</code> blocks with appropriate information.
 +
* Replace license-related blocks with your chosen project license.
  
 
== Optional dependencies ==
 
== Optional dependencies ==
Line 98: Line 132:
 
<groupId>net.imagej</groupId>
 
<groupId>net.imagej</groupId>
 
<artifactId>imagej-legacy</artifactId>
 
<artifactId>imagej-legacy</artifactId>
</dependency>
 
 
<!-- Run graphically with the ImageJ2 user interface-->
 
<dependency>
 
<groupId>net.imagej</groupId>
 
<artifactId>imagej-ui-swing</artifactId>
 
 
</dependency>
 
</dependency>
 
</source>
 
</source>

Revision as of 20:01, 25 January 2017

Template:DevelopmentWhen 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>org.scijava</groupId>
		<artifactId>pom-scijava</artifactId>
		<version>12.0.0</version>
		<relativePath />
	</parent>

	<groupId>[MY-GROUP-ID]</groupId>
	<artifactId>[MY-ARTIFACT-ID]</artifactId>
	<version>0.1.0-SNAPSHOT</version>

	<name>[MY-PROJECT]</name>
	<description>[MY-DESCRIPTION]</description>
	<url>https://github.com/[MY-ORG]/[MY-REPO]</url>
	<inceptionYear>[MY-PROJECT'S-FIRST-YEAR]</inceptionYear>
	<organization>
		<name>[MY-ORGANIZATION-NAME]</name>
		<url>[MY-ORGANIZATION-WEB-SITE]</url>
	</organization>
	<licenses>
		<license>
			<name>CC0 1.0 Universal License</name>
			<url>http://creativecommons.org/publicdomain/zero/1.0/</url>
			<distribution>repo</distribution>
		</license>
	</licenses>

	<developers>
		<developer>
			<id>[MY-GITHUB-ID]</id>
			<name>[MY-FULL-NAME]</name>
			<url>https://imagej.net/User:[MY-IMAGEJ-WIKI-ACCOUNT]</url>
			<roles>
				<!-- see https://imagej.net/Team -->
				<role>founder</role>
				<role>lead</role>
				<role>developer</role>
				<role>debugger</role>
				<role>reviewer</role>
				<role>support</role>
				<role>maintainer</role>
			</roles>
		</developer>
	</developers>
	<contributors>
		<contributor>
			<name>None</name>
		</contributor>
	</contributors>

	<mailingLists>
		<mailingList>
			<name>ImageJ Forum</name>
			<archive>http://forum.imagej.net/</archive>
		</mailingList>
	</mailingLists>

	<scm>
		<connection>scm:git:git://github.com/[MY-ORG]/[MY-REPO]</connection>
		<developerConnection>scm:git:git@github.com:[MY-ORG]/[MY-REPO]</developerConnection>
		<tag>HEAD</tag>
		<url>https://github.com/[MY-ORG]/[MY-REPO]</url>
	</scm>
	<issueManagement>
		<system>GitHub Issues</system>
		<url>http://github.com/[MY-ORG]/[MY-REPO]/issues</url>
	</issueManagement>
	<ciManagement>
		<system>None</system>
	</ciManagement>

	<properties>
		<main-class>[MY-MAIN-CLASS-INCLUDING-PACKAGE]</main-class>
		<package-name>[MY-PACKAGE-PREFIX]</package-name>
		<license.licenseName>cc0</license.licenseName>
		<license.copyrightOwners>N/A</license.copyrightOwners>
	</properties>

	<repositories>
		<repository>
			<id>imagej.public</id>
			<url>http://maven.imagej.net/content/groups/public</url>
		</repository>
	</repositories>

	<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>
</project>
  • Replace the [MY-...] blocks with appropriate information.
  • Replace license-related blocks with your chosen project license.

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>