Difference between revisions of "Building a POM"

(Initial version)
 
(Optional dependencies: Add sc.fiji:fiji as an option)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
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.
+
{{DevelopMenu | 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.
 
 
 
 
  
 
= 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>Image.sc Forum</name>
 +
<archive>https://forum.image.sc/</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 100: Line 134:
 
</dependency>
 
</dependency>
  
<!-- Run graphically with the ImageJ2 user interface-->
+
<!-- Include all Fiji plugins when running -->
 
<dependency>
 
<dependency>
<groupId>net.imagej</groupId>
+
<groupId>sc.fiji</groupId>
<artifactId>imagej-ui-swing</artifactId>
+
<artifactId>fiji</artifactId>
 
</dependency>
 
</dependency>
 
</source>
 
</source>

Latest revision as of 08:18, 10 November 2019

Development
Topics
Overview
Philosophy
Architecture
Source code
Project management
Coding style
Debugging
Tools
GitHub
Git
Maven
IDEs
Travis
AppVeyor
Dotfiles
Guides
Writing plugins
ImageJ Ops
Contributing to a plugin
Distributing your plugins
Development lifecycle
Building a POM
Developing with Eclipse
Hands-on debugging
Adding new ops
Adding new formats
Using native libraries
Tips for developers
Tips for C++ developers
ImageJ 1.x plugins
Versioning
Logging
Uber-JARs

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>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>Image.sc Forum</name>
			<archive>https://forum.image.sc/</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>

<!-- Include all Fiji plugins when running -->
<dependency>
	<groupId>sc.fiji</groupId>
	<artifactId>fiji</artifactId>
</dependency>