Skip to content

Instantly share code, notes, and snippets.

@florianthiery
Last active January 31, 2024 09:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save florianthiery/a5b3f12067301b0ee82acfae4a6c6e6c to your computer and use it in GitHub Desktop.
Save florianthiery/a5b3f12067301b0ee82acfae4a6c6e6c to your computer and use it in GitHub Desktop.
pom.xml examples

pom.xml examples

License: CC BY 4.0

Florian Thiery M.Sc.

Römisch-Germanisches Zentralmuseum (RGZM)

i3mainz - Institut für Raumbezogene Informations- und Messtechnik

<?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>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<artifactId>foo</artifactId>
<!-- groupId: topLevelDomain.githubUserName.artifactId -->
<groupId>de.rgzm.foo</groupId>
<!-- if not in 1.0 release set to 1.0-SNAPSHOT -->
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>foo name</name>
<description>foo desc</description>
<url>https://github.com/rgzm/foo.git</url>
<licenses>
<license>
<name>MIT License</name>
<url>https://github.com/rgzm/foo/blob/master/LICENSE</url>
<distribution>repo</distribution>
</license>
</licenses>
<organization>
<name>Römisch-Germanisches Zentralmuseum (RGZM)</name>
<url>http://rgzm.de</url>
</organization>
<scm>
<connection>scm:git:https://github.com/rgzm/foo.git</connection>
</scm>
<developers>
<developer>
<name>bar</name>
<url>http://bar.io</url>
</developer>
</developers>
<profiles>
<profile>
<id>java8-doclint-disabled</id>
<activation>
<jdk>[1.8,)</jdk>
</activation>
<properties>
<javadoc.opts>-Xdoclint:none</javadoc.opts>
</properties>
</profile>
</profiles>
<build>
<!-- set final name of jar -->
<finalName>${project.artifactId}</finalName>
<plugins>
<!-- plugin: get git commit number via http://www.mojohaus.org/buildnumber-maven-plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
<!-- set commit no. to short version with X digits -->
<!--<shortRevisionLength>7</shortRevisionLength>-->
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<mainClass>de.rgzm.foo.run.Main</mainClass>
</configuration>
</plugin>
</plugins>
<resources>
<!-- get config.properties access to pom.xml -->
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<reporting>
<plugins>
<!-- http://maven.apache.org/surefire/maven-surefire-report-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.20</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<additionalparam>${javadoc.opts}</additionalparam>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
<?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>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<artifactId>foo</artifactId>
<!-- groupId: topLevelDomain.githubUserName.artifactId -->
<groupId>de.rgzm.foo</groupId>
<!-- if not in 1.0 release set to 1.0-SNAPSHOT -->
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>foo name</name>
<description>foo desc</description>
<url>https://github.com/rgzm/foo.git</url>
<licenses>
<license>
<name>MIT License</name>
<url>https://github.com/rgzm/foo/blob/master/LICENSE</url>
<distribution>repo</distribution>
</license>
</licenses>
<organization>
<name>Römisch-Germanisches Zentralmuseum (RGZM)</name>
<url>http://rgzm.de</url>
</organization>
<scm>
<connection>scm:git:https://github.com/rgzm/foo.git</connection>
</scm>
<developers>
<developer>
<name>bar</name>
<url>http://bar.io</url>
</developer>
</developers>
<repositories>
<!-- add https://jitpack.io -->
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<profiles>
<profile>
<id>java8-doclint-disabled</id>
<activation>
<jdk>[1.8,)</jdk>
</activation>
<properties>
<javadoc.opts>-Xdoclint:none</javadoc.opts>
</properties>
</profile>
</profiles>
<build>
<!-- set final name of jar -->
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>7.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<!-- plugin: get git commit number via http://www.mojohaus.org/buildnumber-maven-plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
<!-- set commit no. to short version with X digits -->
<!--<shortRevisionLength>7</shortRevisionLength>-->
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
<!-- run tomcat on port 8080 -> http://localhost:8080 -->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<path>/</path>
</configuration>
</plugin>
</plugins>
<resources>
<!-- get config.properties access to pom.xml -->
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<reporting>
<plugins>
<!-- http://maven.apache.org/surefire/maven-surefire-report-plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.20</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<additionalparam>${javadoc.opts}</additionalparam>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment