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

    Copyright © 2013 Sebastian Hoß <mail@shoss.de>
    This work is free. You can redistribute it and/or modify it under the
    terms of the Do What The Fuck You Want To Public License, Version 2,
    as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.

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

  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!--                                 PARENT                                  -->
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <parent>
    <groupId>com.github.sebhoss</groupId>
    <artifactId>superpom</artifactId>
    <version>1.0.4</version>
  </parent>

  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!--                               INFORMATIONS                              -->
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <artifactId>java-parent</artifactId>
  <version>1.0.5</version>
  <packaging>pom</packaging>
  <inceptionYear>2013</inceptionYear>
  <url>https://github.com/sebhoss/java-parent</url>
  <name>Java Parent</name>
  <description>Parent POM for all Java-based projects</description>

  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!--                                  SOURCE                                 -->
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <scm>
    <connection>scm:git:git://github.com/sebhoss/java-parent.git</connection>
    <developerConnection>scm:git:git@github.com:sebhoss/java-parent.git</developerConnection>
    <tag>master</tag>
    <url>${project.url}</url>
  </scm>

  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!--                                PROPERTIES                               -->
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <properties>
    <version.jdk>1.7</version.jdk>
    <version.tycho>0.18.1</version.tycho>

    <coverage>0</coverage>
    <pmd.cpd.tokens>50</pmd.cpd.tokens>
  </properties>

  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!--                                   BUILD                                 -->
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>2.2.1</version>
        <configuration>
          <archive>
            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
          </archive>
        </configuration>
        <executions>
          <execution>
            <id>attach-sources</id>
            <phase>verify</phase>
            <goals>
              <goal>jar-no-fork</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.9.1</version>
        <configuration>
          <outputDirectory>${project.build.directory}/api</outputDirectory>
          <links>
            <link>http://download.oracle.com/javase/7/docs/api/</link>
          </links>
          <detectLinks>true</detectLinks>
          <archive>
            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
          </archive>
        </configuration>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <!-- Can't use 3.X due to https://bugs.eclipse.org/bugs/show_bug.cgi?id=405385 -->
        <version>2.5.1</version>
        <configuration>
          <source>${version.jdk}</source>
          <target>${version.jdk}</target>
          <compilerId>jdt</compilerId>
          <compilerArguments>
            <properties>${project.basedir}/.settings/org.eclipse.jdt.core.prefs</properties>
          </compilerArguments>
        </configuration>
        <dependencies>
          <!-- This dependency provides the implementation of compiler "jdt": -->
          <dependency>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>tycho-compiler-jdt</artifactId>
            <version>${version.tycho}</version>
          </dependency>
        </dependencies>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <!-- Cant use 2.4.X due to https://github.com/tesla/m2eclipse-extras/issues/10 -->
        <version>2.3.2</version>
        <configuration>
          <archive>
            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
          </archive>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>2.4.0</version>
        <executions>
          <execution>
            <id>bundle-manifest</id>
            <phase>process-classes</phase>
            <goals>
              <goal>manifest</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <instructions>
            <Bundle-Copyright>${project.developers[0].name} (${project.developers[0].email})</Bundle-Copyright>
            <Bundle-DocURL>${project.url}</Bundle-DocURL>
          </instructions>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>findbugs-maven-plugin</artifactId>
        <version>2.5.2</version>
        <configuration>
          <effort>Max</effort>
          <threshold>Low</threshold>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
        <version>3.0.1</version>
        <configuration>
          <failurePriority>0</failurePriority>
          <minimumTokens>${pmd.cpd.tokens}</minimumTokens>
          <targetJdk>${version.jdk}</targetJdk>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>check</goal>
              <goal>cpd-check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>cobertura-maven-plugin</artifactId>
        <version>2.5.2</version>
        <configuration>
          <check>
            <haltOnFailure>true</haltOnFailure>
            <branchRate>${coverage}</branchRate>
            <lineRate>${coverage}</lineRate>
            <totalBranchRate>${coverage}</totalBranchRate>
            <totalLineRate>${coverage}</totalLineRate>
            <packageLineRate>${coverage}</packageLineRate>
            <packageBranchRate>${coverage}</packageBranchRate>
          </check>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>clean</goal>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-remote-resources-plugin</artifactId>
        <version>1.5</version>
        <executions>
          <execution>
            <id>jdt-compiler-settings</id>
            <goals>
              <goal>process</goal>
            </goals>
            <configuration>
              <resourceBundles>
                <resourceBundle>com.github.sebhoss:jdt-settings:1.0.1</resourceBundle>
              </resourceBundles>
              <outputDirectory>${project.basedir}/.settings</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
