Skip to content

Company parent pom example for only Java projects

<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.company</groupId>
  <artifactId>company-parent</artifactId>
  <packaging>pom</packaging>
  <version>11</version>
  <name>Company Parent POM</name>
  <url>http://www.company.com/</url>

  <issueManagement>
    <system>jira</system>
    <url>http://jira.company.com/</url>
  </issueManagement>

  <ciManagement>
    <system>Continuum</system>
    <url>http://ci.company.com</url>
    <notifiers>
      <notifier>
        <configuration>
          <address>name@company.com</address>
        </configuration>
      </notifier>
    </notifiers>
  </ciManagement>

  <inceptionYear>2008</inceptionYear>

  <mailingLists>
    <mailingList>
      <name>ProjectName</name>
      <post>projectName@company.com</post>
    </mailingList>
  </mailingLists>

  <developers>
    <developer>
      <id>erik.drolshammer</id>
      <name>Erik Drolshammer</name>
      <email>erik.drolshammer 'at' company.com</email>
      <roles>
        <role>Java Developer</role>
      </roles>
      <timezone>+1</timezone>
    </developer>
  </developers>

  <scm>
    <connection>scm:svn:svn+ssh://svn.company.com/var/local/repos/projectName/lib/company-parent/</connection>
    <developerConnection>${pom.scm.connection}</developerConnection>
  </scm>

  <organization>
    <name>Company</name>
    <url>${pom.url}</url>
  </organization>

  <repositories>
    <repository>
      <id>central</id>
      <url>${m2repoUrl}</url>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
      <releases>
        <enabled>true</enabled>
      </releases>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <id>central</id>
      <url>${m2repoUrl}</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </pluginRepository>
  </pluginRepositories>

  <build>
    <extensions>
      <extension>
        <groupId>org.apache.maven.wagon</groupId>
        <artifactId>wagon-webdav</artifactId>
        <version>1.0-beta-2</version>
      </extension>
    </extensions>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-antrun-plugin</artifactId>
          <version>1.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>2.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <version>2.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-clean-plugin</artifactId>
          <version>2.2</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>cobertura-maven-plugin</artifactId>
          <version>${cobertura.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>2.0.2</version>
          <configuration>
            <meminitial>128m</meminitial>
            <maxmem>512m</maxmem>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>2.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>2.3</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-eclipse-plugin</artifactId>
          <version>2.5.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-help-plugin</artifactId>
          <version>2.0.2</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-idea-plugin</artifactId>
          <version>2.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-install-plugin</artifactId>
          <version>2.2</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>2.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.0-beta-7</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>2.2</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-scm-plugin</artifactId>
          <version>1.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>2.0.4</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>${surefireVersion}</version>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <!-- banSnapshots is necessary until the enforcer-plugin is released-->
      <!--
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>1.0-SNAPSHOT</version>
        <configuration>
          <rules>
            <requirePluginVersions>
              <message>Best Practice is to always define plugin versions!</message>
              <banSnapshots>false</banSnapshots>
            </requirePluginVersions>
          </rules>
        </configuration>
        <executions>
          <execution>
            <id>enforce-plugin-versions</id>
            <phase>validate</phase>
            <goals>
              <goal>enforce</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      -->
      <!--http://jira.codehaus.org/browse/MRELEASE-271-->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <configuration>
          <preparationGoals>clean install</preparationGoals>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>${jdkVersion}</source>
          <target>${jdkVersion}</target>
          <encoding>${encoding}</encoding>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-eclipse-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-idea-plugin</artifactId>
        <configuration>
          <jdkName>${jdkVersion}</jdkName>
          <jdkLevel>${jdkVersion}</jdkLevel>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>cobertura-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>clean</id>
            <goals>
              <goal>clean</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>unpack-shared-resources</id>
            <goals>
              <goal>unpack-dependencies</goal>
            </goals>
            <phase>pre-site</phase>
            <configuration>
              <outputDirectory>${generatedResourcesDir}</outputDirectory>
              <includeArtifacIds>company-resources</includeArtifacIds>
              <includeGroupIds>com.company.resources</includeGroupIds>
              <!--<excludeTransitive>true</excludeTransitive>-->
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.2.13</version>
    </dependency>
    <dependency>
      <groupId>org.testng</groupId>
      <artifactId>testng</artifactId>
      <version>5.7</version>
      <scope>test</scope>
      <classifier>jdk15</classifier>
    </dependency>
    <dependency>
      <groupId>com.company.resources</groupId>
      <artifactId>company-resources</artifactId>
      <version>1</version>
    </dependency>
  </dependencies>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <version>2.0-beta-7</version>
        <configuration>
          <locales>en</locales>
          <inputEncoding>${encoding}</inputEncoding>
          <outputEncoding>${encoding}</outputEncoding>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <version>2.1</version>
        <!-- If all goals are relevant, the whole reportSet can be omitted. -->
        <!-- Goals: http://maven.apache.org/plugins/maven-project-info-reports-plugin/plugin-info.html-->
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.3</version>
        <configuration>
          <encoding>${encoding}</encoding>
          <quiet>true</quiet>
          <aggregate>true</aggregate>
          <doclet>gr.spinellis.umlgraph.doclet.UmlGraphDoc</doclet>
          <docletArtifact>
            <groupId>gr.spinellis</groupId>
            <artifactId>UmlGraph</artifactId>
            <version>4.6</version>
          </docletArtifact>
          <additionalparam>
            -inferrel -inferdep -quiet -hide java.* -collpackages java.util.* -qualify -postfixpackage -nodefontsize 9
            -nodefontpackagesize 7
            -link http://java.sun.com/j2se/1.5.0/docs/api/
            -link http://java.sun.com/javaee/5/docs/api/
          </additionalparam>
        </configuration>
        <reportSets>
          <reportSet>
            <reports>
              <report>javadoc</report>
              <!-- <report>test-javadoc</report> -->
            </reports>
          </reportSet>
        </reportSets>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jxr-plugin</artifactId>
        <version>2.1</version>
        <configuration>
          <linkJavadoc>true</linkJavadoc>
          <javadocDir>${project.build.directory}/apidocs</javadocDir>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${surefireVersion}</version>
      </plugin>

      <plugin>
        <!-- http://pmd.sourceforge.net/bestpractices.html -->
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
        <version>2.4</version>
        <configuration>
          <sourceEncoding>${encoding}</sourceEncoding>
          <targetJdk>${jdkVersion}</targetJdk>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>2.2</version>
        <configuration>
          <enableRSS>false</enableRSS>
          <!--<enableFilesSummary>false</enableFilesSummary>-->
          <enableRulesSummary>false</enableRulesSummary>
          <!--
          <configLocation>${generatedResourcesDir}/checkstyle-company.xml</configLocation>
          <suppressionsLocation>${generatedResourcesDir}/checkstyle-suppressions.xml</suppressionsLocation>
          -->
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>taglist-maven-plugin</artifactId>
        <version>2.1</version>
        <configuration>
          <tags>
            <tag>@deprecated</tag>
            <tag>TODO</tag>
            <tag>@todo</tag>
            <tag>FIXME</tag>
            <tag>XXX</tag>
          </tags>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-report-plugin</artifactId>
        <version>2.4.2</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-changelog-plugin</artifactId>
        <version>2.1</version>
        <configuration>
          <connectionType>developerConnection</connectionType>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>clirr-maven-plugin</artifactId>
        <version>2.2.1</version>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>jdepend-maven-plugin</artifactId>
        <version>2.0-beta-1</version>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>cobertura-maven-plugin</artifactId>
        <version>${cobertura.version}</version>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>findbugs-maven-plugin</artifactId>
        <version>1.2</version>
        <configuration>
          <xmlOutput>false</xmlOutput>
          <threshold>Normal</threshold>
          <effort>Default</effort>

          <excludeFilterFile>${generatedResourcesDir}/findbugs-exclude.xml</excludeFilterFile>
          <visitors>FindDeadLocalStores,UnreadFields</visitors>
          <omitVisitors>FindDeadLocalStores,UnreadFields</omitVisitors>
        </configuration>
      </plugin>

    </plugins>
  </reporting>

  <distributionManagement>
    <site>
      <id>site</id>
      <url>${siteUrl}</url>
    </site>
    <repository>
      <id>libs-releases</id>
      <name>Company Internal Release Repository</name>
      <url>dav:${releaseRepoUrl}</url>
    </repository>
    <snapshotRepository>
      <id>libs-snapshots</id>
      <name>Company Internal Snapshot Repository</name>
      <url>dav:${snapshotRepoUrl}</url>
    </snapshotRepository>
  </distributionManagement>

  <properties>
    <repoUrl>http://10.0.0.3:8081/artifactory</repoUrl>
    <m2repoUrl>${repoUrl}/projectName</m2repoUrl>
    <releaseRepoUrl>${repoUrl}/libs-releases</releaseRepoUrl>
    <snapshotRepoUrl>${repoUrl}/libs-snapshots</snapshotRepoUrl>
    <siteBaseUrl>file:///var/www/html/sites</siteBaseUrl>
    <siteUrl>${siteBaseUrl}/lib/</siteUrl>
    <surefireVersion>2.4</surefireVersion>
    <cobertura.version>2.2</cobertura.version>
    <generatedResourcesDir>${project.build.directory}/generated-resources</generatedResourcesDir>
    <jdkVersion>1.6</jdkVersion>
    <encoding>UTF-8</encoding>
  </properties>

  <profiles>
    <profile>
      <id>ide</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-idea-plugin</artifactId>
            <configuration>
              <downloadSources>true</downloadSources>
              <downloadJavadocs>true</downloadJavadocs>
            </configuration>
          </plugin>
          <plugin>
            <artifactId>maven-eclipse-plugin</artifactId>
            <configuration>
              <downloadSources>true</downloadSources>
              <downloadJavadocs>true</downloadJavadocs>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>