<?xml version="1.0" encoding="UTF-8"?>
<!--

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

-->
<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>

  <groupId>org.basepom</groupId>
  <artifactId>basepom-foundation</artifactId>
  <packaging>pom</packaging>
  <version>2</version>
  <name>basepom-foundation</name>
  <description>Base POM foundation that codifies policy and plugins.</description>

  <url>https://github.com/basepom/basepom/foundation</url>
  <inceptionYear>2013</inceptionYear>

  <licenses>
    <license>
      <name>Apache 2</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
      <comments>A business-friendly OSS license</comments>
    </license>
  </licenses>

  <scm>
    <connection>scm:git:git://github.com/basepom/basepom.git</connection>
    <developerConnection>scm:git:git@github.com:basepom/basepom.git</developerConnection>
    <url>https://github.com/basepom/basepom</url>
    <tag>build-basepom-root-2</tag>
  </scm>

  <developers>
    <developer>
      <id>hgschmie</id>
      <name>Henning Schmiedehausen</name>
      <email>henning@schmiedehausen.org</email>
      <timezone>-8</timezone>
    </developer>
  </developers>

  <properties>
    <!-- see http://docs.codehaus.org/display/MAVENUSER/POM+Element+for+Source+File+Encoding -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.build.targetJdk>1.7</project.build.targetJdk>
    <project.report.outputEncoding>UTF-8</project.report.outputEncoding>
    <project.report.inputEncoding>UTF-8</project.report.inputEncoding>

    <!-- Build specific options are prefixed basepom.build. -->

    <!-- Default jvm size for compiler, tests etc. -->
    <basepom.build.jvmsize>1024m</basepom.build.jvmsize>

    <!-- whether a release:perform automatically pushes the created files and tags to -->
    <!-- the upstream repository. Default is no. -->
    <basepom.release.push-changes>false</basepom.release.push-changes>

    <!-- define the forkmode for tests. Default is 'once' -->
    <basepom.test.fork-mode>once</basepom.test.fork-mode>

    <!-- Controls all the checkers run when building the project.                 -->
    <!-- Can be activated with -Dbasepom.check.skip-all=true on the command line. -->
    <basepom.check.skip-all>false</basepom.check.skip-all>
    <!-- Controls the basic checkers run when building the project.               -->
    <basepom.check.skip-basic>${basepom.check.skip-all}</basepom.check.skip-basic>
    <!-- Controls the extended checkers run when building the project.            -->
    <basepom.check.skip-extended>${basepom.check.skip-all}</basepom.check.skip-extended>

    <!-- basic checks -->
    <basepom.check.skip-enforcer>${basepom.check.skip-basic}</basepom.check.skip-enforcer>
    <basepom.check.skip-dependency>${basepom.check.skip-basic}</basepom.check.skip-dependency>
    <basepom.check.skip-duplicate-finder>${basepom.check.skip-basic}</basepom.check.skip-duplicate-finder>
    <basepom.check.skip-dependency-version-check>${basepom.check.skip-basic}</basepom.check.skip-dependency-version-check>

    <!-- extended checks -->
    <basepom.check.skip-findbugs>${basepom.check.skip-extended}</basepom.check.skip-findbugs>
    <basepom.check.skip-pmd>${basepom.check.skip-extended}</basepom.check.skip-pmd>
    <basepom.check.skip-jacoco>${basepom.check.skip-extended}</basepom.check.skip-jacoco>

    <basepom.check.fail-all>true</basepom.check.fail-all>
    <basepom.check.fail-basic>${basepom.check.fail-all}</basepom.check.fail-basic>
    <basepom.check.fail-extended>${basepom.check.fail-all}</basepom.check.fail-extended>

    <!-- basic checks -->
    <basepom.check.fail-enforcer>${basepom.check.fail-basic}</basepom.check.fail-enforcer>
    <basepom.check.fail-dependency>${basepom.check.fail-basic}</basepom.check.fail-dependency>
    <basepom.check.fail-duplicate-finder>${basepom.check.fail-basic}</basepom.check.fail-duplicate-finder>
    <basepom.check.fail-dependency-version-check>${basepom.check.fail-basic}</basepom.check.fail-dependency-version-check>

    <!-- extended checks -->
    <basepom.check.fail-findbugs>${basepom.check.fail-extended}</basepom.check.fail-findbugs>
    <basepom.check.fail-pmd>${basepom.check.fail-extended}</basepom.check.fail-pmd>

    <!-- the current "best" version of maven -->
    <basepom.maven.version>3.0.5</basepom.maven.version>

    <!-- In Multimodule builds, override this to point at the parent directory for e.g. the license resources. -->
    <!-- See http://stackoverflow.com/questions/1012402/maven2-property-that-indicates-the-parent-directory    -->
    <basepom.main.basedir>${project.basedir}</basepom.main.basedir>

    <!-- Plugin versions used in multiple places -->
    <dep.plugin.findbugs.version>2.5.2</dep.plugin.findbugs.version>
    <dep.plugin.jacoco.version>0.6.3.201306030806</dep.plugin.jacoco.version>
    <dep.plugin.javadoc.version>2.9.1</dep.plugin.javadoc.version>
    <dep.plugin.pmd.version>3.0.1</dep.plugin.pmd.version>
    <dep.plugin.scm.version>1.8.1</dep.plugin.scm.version>
    <dep.plugin.site.version>3.3</dep.plugin.site.version>
    <dep.plugin.surefire.version>2.16</dep.plugin.surefire.version>
  </properties>

  <prerequisites>
    <maven>${basepom.maven.version}</maven>
  </prerequisites>

  <build>
    <extensions>
      <extension>
        <groupId>org.apache.maven.scm</groupId>
        <artifactId>maven-scm-provider-gitexe</artifactId>
        <version>${dep.plugin.scm.version}</version>
      </extension>
      <extension>
        <groupId>org.apache.maven.scm</groupId>
        <artifactId>maven-scm-manager-plexus</artifactId>
        <version>${dep.plugin.scm.version}</version>
      </extension>
      <extension>
        <groupId>com.github.stephenc.wagon</groupId>
        <artifactId>wagon-gitsite</artifactId>
        <version>0.4.1</version>
      </extension>
    </extensions>

    <pluginManagement>
      <plugins>
        <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. -->
        <!-- The plugin versions in here are pure "range", don't bother syncing them to the actual plugins. -->
        <plugin>
          <groupId>org.eclipse.m2e</groupId>
          <artifactId>lifecycle-mapping</artifactId>
          <version>1.0.0</version>
          <configuration>
            <lifecycleMappingMetadata>
              <pluginExecutions>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <versionRange>[0,)</versionRange>
                    <goals>
                      <goal>enforce</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <versionRange>[0,)</versionRange>
                    <goals>
                      <goal>analyze-dep-mgt</goal>
                      <goal>analyze-duplicate</goal>
                      <goal>analyze-only</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>com.ning.maven.plugins</groupId>
                    <artifactId>maven-duplicate-finder-plugin</artifactId>
                    <versionRange>[0,)</versionRange>
                    <goals>
                      <goal>check</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>com.ning.maven.plugins</groupId>
                    <artifactId>maven-dependency-versions-check-plugin</artifactId>
                    <versionRange>[0,)</versionRange>
                    <goals>
                      <goal>check</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <versionRange>[0,)</versionRange>
                    <goals>
                      <goal>prepare-agent</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-scm-plugin</artifactId>
          <version>${dep.plugin.scm.version}</version>
          <configuration>
            <connectionType>developerConnection</connectionType>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>2.7</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-clean-plugin</artifactId>
          <version>2.5</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-install-plugin</artifactId>
          <version>2.5</version>
        </plugin>

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>1.8</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>1.3.1</version>
          <configuration>
            <skip>${basepom.check.skip-enforcer}</skip>
            <fail>${basepom.check.fail-enforcer}</fail>
            <failFast>false</failFast>
            <rules>
              <requireMavenVersion>
                <version>[${basepom.maven.version},)</version>
              </requireMavenVersion>
              <requireJavaVersion>
                <version>${project.build.targetJdk}</version>
              </requireJavaVersion>
            </rules>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>2.8</version>
          <configuration>
            <skip>${basepom.check.skip-dependency}</skip>
            <failOnWarning>${basepom.check.fail-dependency}</failOnWarning>
            <ignoreNonCompile>true</ignoreNonCompile>
          </configuration>
        </plugin>

        <!-- Tweak the compiler to use more memory and use UTF-8 for the source code. -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.1</version>
          <configuration>
            <source>${project.build.targetJdk}</source>
            <target>${project.build.targetJdk}</target>
            <encoding>${project.build.sourceEncoding}</encoding>
            <maxmem>${basepom.build.jvmsize}</maxmem>
            <showWarnings>true</showWarnings>
            <compilerArguments>
              <Werror />
            </compilerArguments>
          </configuration>
        </plugin>

        <!-- Resource plugins should always use UTF-8 -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>2.6</version>
          <configuration>
            <encoding>${project.build.sourceEncoding}</encoding>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>2.4</version>
          <configuration>
            <!-- must be true for jar-with-dependencies builds -->
            <appendAssemblyId>true</appendAssemblyId>
            <!-- Always use GNU tar mode. -->
            <tarLongFileMode>gnu</tarLongFileMode>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>${dep.plugin.surefire.version}</version>
          <configuration>
            <argLine>-Dfile.encoding=${project.build.sourceEncoding}</argLine>
            <systemPropertyVariables>
              <sun.jnu.encoding>${project.build.sourceEncoding}</sun.jnu.encoding>
              <user.timezone>UTC</user.timezone>
              <java.awt.headless>true</java.awt.headless>
            </systemPropertyVariables>
            <forkMode>${basepom.test.fork-mode}</forkMode>
            <runOrder>random</runOrder>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.4.1</version>
          <configuration>
            <autoVersionSubmodules>true</autoVersionSubmodules>
            <mavenExecutorId>forked-path</mavenExecutorId>
            <pushChanges>${basepom.release.push-changes}</pushChanges>
            <localCheckout>true</localCheckout>
            <preparationGoals>clean install</preparationGoals>
            <useReleaseProfile>false</useReleaseProfile>
            <goals>deploy</goals>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>${dep.plugin.javadoc.version}</version>
          <configuration>
            <source>${project.build.targetJdk}</source>
            <target>${project.build.targetJdk}</target>
            <encoding>${project.build.sourceEncoding}</encoding>
            <maxmemory>${basepom.build.jvmsize}</maxmemory>
            <additionalparam>-quiet</additionalparam>
          </configuration>
        </plugin>

        <!-- Always build a jar with the test classes -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>2.4</version>
          <configuration>
            <!-- do not build an empty jar if the project is
                 e.g. a pom project -->
            <skipIfEmpty>true</skipIfEmpty>
            <archive>
              <manifest>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                <addClasspath>false</addClasspath>
              </manifest>
            </archive>
          </configuration>
        </plugin>

        <!-- bundle up source code into jars for both the main and the test sources -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>2.2.1</version>
        </plugin>

        <plugin>
          <groupId>com.ning.maven.plugins</groupId>
          <artifactId>maven-dependency-versions-check-plugin</artifactId>
          <version>2.0.2</version>
          <configuration>
            <skip>${basepom.check.skip-dependency-version-check}</skip>
            <failBuildInCaseOfConflict>${basepom.check.fail-dependency-version-check}</failBuildInCaseOfConflict>
            <failOnWarning>${basepom.check.fail-dependency-version-check}</failOnWarning>
          </configuration>
        </plugin>

        <plugin>
          <groupId>com.ning.maven.plugins</groupId>
          <artifactId>maven-duplicate-finder-plugin</artifactId>
          <version>1.0.4</version>
          <configuration>
            <skip>${basepom.check.skip-duplicate-finder}</skip>
            <failBuildInCaseOfConflict>${basepom.check.fail-duplicate-finder}</failBuildInCaseOfConflict>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>findbugs-maven-plugin</artifactId>
          <version>${dep.plugin.findbugs.version}</version>
          <configuration>
            <skip>${basepom.check.skip-findbugs}</skip>
            <jvmargs>-Xmx${basepom.build.jvmsize}</jvmargs>
            <failOnError>${basepom.check.fail-findbugs}</failOnError>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-pmd-plugin</artifactId>
          <version>${dep.plugin.pmd.version}</version>
          <configuration>
            <skip>${basepom.check.skip-pmd}</skip>
            <failOnViolation>${basepom.check.fail-pmd}</failOnViolation>
            <targetJdk>${project.build.targetJdk}</targetJdk>
            <sourceEncoding>${project.build.sourceEncoding}</sourceEncoding>
            <minimumTokens>100</minimumTokens>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-shade-plugin</artifactId>
          <version>2.1</version>
        </plugin>

        <plugin>
          <groupId>org.jacoco</groupId>
          <artifactId>jacoco-maven-plugin</artifactId>
          <version>${dep.plugin.jacoco.version}</version>
          <configuration>
            <skip>${basepom.check.skip-jacoco}</skip>
          </configuration>
        </plugin>

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

      </plugins>
    </pluginManagement>

    <!-- This is the list of plugins used for the main build. -->
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-tests</id>
            <phase>package</phase>
            <goals>
              <goal>test-jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-sources</id>
            <phase>package</phase>
            <goals>
              <goal>jar-no-fork</goal>
              <goal>test-jar-no-fork</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <execution>
            <id>default</id>
            <phase>validate</phase>
            <goals>
              <goal>enforce</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>default</id>
            <phase>verify</phase>
            <goals>
              <goal>analyze-only</goal>
              <goal>analyze-duplicate</goal>
              <goal>analyze-dep-mgt</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>com.ning.maven.plugins</groupId>
        <artifactId>maven-dependency-versions-check-plugin</artifactId>
        <executions>
          <execution>
            <id>default</id>
            <phase>verify</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>com.ning.maven.plugins</groupId>
        <artifactId>maven-duplicate-finder-plugin</artifactId>
        <executions>
          <execution>
            <id>default</id>
            <phase>verify</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>findbugs-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>default</id>
            <phase>verify</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
        <executions>
          <execution>
            <id>default</id>
            <phase>verify</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>default</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
