<?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>
  <groupId>com.kohlschutter</groupId>
  <artifactId>kohlschutter-parent</artifactId>
  <version>1.1</version>
  <packaging>pom</packaging>
  <name>kohlschutter-parent</name>
  <inceptionYear>2014</inceptionYear>
  <description>The parent POM for Kohlschütter projects.</description>
  <url>https://github.com/kohlschutter/kohlschutter-parent</url>
  <organization>
    <name>Kohlschütter Search Intelligence</name>
    <url>https://www.kohlschutter.com/</url>
  </organization>
  <developers>
    <developer>
      <name>Christian Kohlschütter</name>
      <email>christian@kohlschutter.com</email>
    </developer>
  </developers>
  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <scm>
    <url>scm:git:https://github.com/kohlschutter/kohlschutter-parent</url>
    <developerConnection>scm:git:https://github.com/kohlschutter/kohlschutter-parent</developerConnection>
    <tag>HEAD</tag>
  </scm>
  <distributionManagement>
    <snapshotRepository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
  </distributionManagement>
  <issueManagement>
    <system>GitHub</system>
    <url>https://github.com/kohlschutter/kohlschutter-parent/issues</url>
  </issueManagement>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.build.resourceEncoding>UTF-8</project.build.resourceEncoding>
    <file.encoding>UTF-8</file.encoding>
    <maven.compile.encoding>UTF-8</maven.compile.encoding>

    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>

    <!-- Projects must define the following property -->
    <kohlschutter.project.base.directory>${project.basedir}</kohlschutter.project.base.directory>

    <coding.style.eclipse.dir>${kohlschutter.project.base.directory}/eclipse</coding.style.eclipse.dir>
    <eclipse.jdt.core.prefs>${coding.style.eclipse.dir}/java7-strict-org.eclipse.jdt.core.prefs</eclipse.jdt.core.prefs>
    <eclipse.formatter.config>${coding.style.eclipse.dir}/eclipse-formatter-config.xml</eclipse.formatter.config>
    <eclipse.checkstyle.config>${coding.style.eclipse.dir}/checkstyle-configuration.xml</eclipse.checkstyle.config>
  </properties>
  <profiles>
    <profile>
      <id>debug-info</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <phase>validate</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <tasks>
                    <echoproperties />
                  </tasks>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- BEGIN: coding-style specific profiles -->
    <!-- Unless you have the "coding-style" project in your eclipse workspace, 
      we will download and unpack that artifact's contents to the top-level project. 
      All Eclipse-specific formatting files will be in the "eclipse" directory. -->
    <profile>
      <id>coding-style-unpack</id>
      <activation>
        <file>
          <missing>${kohlschutter.project.base.directory}/eclipse/eclipse-formatter-config.xml</missing>
        </file>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <id>unpack-coding-style</id>
                <phase>generate-resources</phase>
                <goals>
                  <goal>unpack</goal>
                </goals>
                <configuration>
                  <artifactItems>
                    <artifactItem>
                      <groupId>com.kohlschutter</groupId>
                      <artifactId>coding-style</artifactId>
                      <version>1.0.1</version>
                      <classifier>files</classifier>
                      <type>zip</type>
                      <outputDirectory>${kohlschutter.project.base.directory}/</outputDirectory>
                    </artifactItem>
                  </artifactItems>
                  <skip>${coding.style.skip.unpack}</skip>
                  <verbose>true</verbose>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>coding-style-in-project</id>
      <activation>
        <file>
          <exists>${basedir}/eclipse/eclipse-formatter-config.xml</exists>
        </file>
      </activation>
      <properties>
        <coding.style.skip.unpack>true</coding.style.skip.unpack>
        <coding.style.eclipse.dir>${kohlschutter.project.base.directory}/eclipse</coding.style.eclipse.dir>
        <eclipse.jdt.core.prefs>${coding.style.eclipse.dir}/java7-strict-org.eclipse.jdt.core.prefs</eclipse.jdt.core.prefs>
        <eclipse.formatter.config>${coding.style.eclipse.dir}/eclipse-formatter-config.xml</eclipse.formatter.config>
        <eclipse.checkstyle.config>${coding.style.eclipse.dir}/checkstyle-configuration.xml</eclipse.checkstyle.config>
      </properties>
    </profile>
    <profile>
      <id>coding-style-in-workspace-parent1</id>
      <activation>
        <file>
          <exists>${basedir}/../coding-style/eclipse/eclipse-formatter-config.xml</exists>
        </file>
      </activation>
      <properties>
        <coding.style.skip.unpack>true</coding.style.skip.unpack>
        <coding.style.eclipse.dir>${basedir}/../coding-style/eclipse</coding.style.eclipse.dir>
        <eclipse.jdt.core.prefs>${coding.style.eclipse.dir}/java7-strict-org.eclipse.jdt.core.prefs</eclipse.jdt.core.prefs>
        <eclipse.formatter.config>${coding.style.eclipse.dir}/eclipse-formatter-config.xml</eclipse.formatter.config>
        <eclipse.checkstyle.config>${coding.style.eclipse.dir}/checkstyle-configuration.xml</eclipse.checkstyle.config>
      </properties>
    </profile>
    <profile>
      <id>coding-style-in-workspace-parent2</id>
      <activation>
        <file>
          <exists>${basedir}/../../coding-style/eclipse/eclipse-formatter-config.xml</exists>
        </file>
      </activation>
      <properties>
        <coding.style.skip.unpack>true</coding.style.skip.unpack>
        <coding.style.eclipse.dir>${basedir}/../../coding-style/eclipse</coding.style.eclipse.dir>
        <eclipse.jdt.core.prefs>${coding.style.eclipse.dir}/java7-strict-org.eclipse.jdt.core.prefs</eclipse.jdt.core.prefs>
        <eclipse.formatter.config>${coding.style.eclipse.dir}/eclipse-formatter-config.xml</eclipse.formatter.config>
        <eclipse.checkstyle.config>${coding.style.eclipse.dir}/checkstyle-configuration.xml</eclipse.checkstyle.config>
      </properties>
    </profile>
    <profile>
      <id>eclipse-compiler-checks</id>
      <!-- run as: mvn clean integration-test -Peclipse-compiler-checks -->
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <!-- won't work with 3.2 -->
            <version>3.1</version>
            <configuration>
              <compilerId>eclipse</compilerId>
              <compilerArguments>
                <!-- prefs should contain "org.eclipse.jdt.core.compiler.doc.comment.support=enabled" -->
                <properties>${eclipse.jdt.core.prefs}</properties>
              </compilerArguments>
              <fork>true</fork>
            </configuration>
            <dependencies>
              <dependency>
                <groupId>org.codehaus.plexus</groupId>
                <artifactId>plexus-compiler-eclipse</artifactId>
                <version>2.4</version>
                <exclusions>
                  <exclusion>
                    <groupId>org.eclipse.tycho</groupId>
                    <artifactId>org.eclipse.jdt.core</artifactId>
                  </exclusion>
                </exclusions>
              </dependency>
              <dependency>
                <groupId>org.eclipse.jdt.core.compiler</groupId>
                <artifactId>ecj</artifactId>
                <version>4.4</version>
              </dependency>
            </dependencies>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
            <executions>
              <execution>
                <id>enforce</id>
                <!-- Prevents installation of ECJ-compiled classes -->
                <goals>
                  <goal>enforce</goal>
                </goals>
                <phase>install</phase>
                <configuration>
                  <rules>
                    <AlwaysFail />
                  </rules>
                  <fail>true</fail>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <!-- END: coding-style specific profiles -->

  </profiles>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>${maven.compiler.source}</source>
          <target>${maven.compiler.target}</target>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-source-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-sources</id>
            <goals>
              <goal>jar-no-fork</goal>
            </goals>
          </execution>
        </executions>
        <inherited>true</inherited>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <!-- invoke with mvn java-formatter:format -->
        <groupId>com.googlecode.maven-java-formatter-plugin</groupId>
        <artifactId>maven-java-formatter-plugin</artifactId>
        <configuration>
          <compilerCompliance>${maven.compiler.target}</compilerCompliance>
          <compilerSource>${maven.compiler.source}</compilerSource>
          <compilerTargetPlatform>${maven.compiler.target}</compilerTargetPlatform>
          <lineEnding>LF</lineEnding>
          <configFile>${eclipse.formatter.config}</configFile>
          <overrideConfigCompilerVersion>true</overrideConfigCompilerVersion>
          <includes>
            <include>com/kohlschutter/**/*.java</include>
            <include>org/kohlschutter/**/*.java</include>
            <include>org/newsclub/**/*.java</include>
          </includes>
        </configuration>
      </plugin>
      <plugin>
        <!-- invoke with mvn license:format -->
        <groupId>com.mycila</groupId>
        <artifactId>license-maven-plugin</artifactId>
        <configuration>
          <header>${kohlschutter.project.base.directory}/LICENSE</header>
          <includes>
            <include>src/main/java/org/newsclub/**/*.java</include>
            <include>src/test/java/org/newsclub/**/*.java</include>
          </includes>
          <excludes>
            <exclude>**/package-info.java</exclude>
          </excludes>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>versions-maven-plugin</artifactId>
        <configuration>
          <generateBackupPoms>false</generateBackupPoms>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-scm-plugin</artifactId>
        <configuration>
          <tag>${project.artifactId}-${project.version}</tag>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.sonatype.plugins</groupId>
        <artifactId>nexus-staging-maven-plugin</artifactId>
        <extensions>true</extensions>
        <configuration>
          <serverId>ossrh</serverId>
          <nexusUrl>https://oss.sonatype.org/</nexusUrl>
          <autoReleaseAfterClose>false</autoReleaseAfterClose>
        </configuration>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <version>2.13</version>
          <configuration>
            <configLocation>${eclipse.checkstyle.config}</configLocation>
          </configuration>
          <dependencies>
            <dependency>
              <!-- Use the same checkstyle version as in eclipse-cs -->
              <groupId>com.puppycrawl.tools</groupId>
              <artifactId>checkstyle</artifactId>
              <version>6.1.1</version>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <!--This plugin's configuration is used to store Eclipse m2e settings 
            only. It has no influence on the Maven build itself. -->
          <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-dependency-plugin</artifactId>
                    <versionRange>[2.9,)</versionRange>
                    <goals>
                      <goal>unpack</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>2.9</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>2.4</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>2.10.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.2</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.18</version>
          <configuration>
            <argLine>-Dfile.encoding=UTF-8</argLine>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-clean-plugin</artifactId>
          <version>2.6.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-antrun-plugin</artifactId>
          <version>1.7</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>2.5</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-install-plugin</artifactId>
          <version>2.5.2</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-project-info-reports-plugin</artifactId>
          <version>2.7</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>1.5</version>
        </plugin>
        <plugin>
          <groupId>com.googlecode.maven-java-formatter-plugin</groupId>
          <artifactId>maven-java-formatter-plugin</artifactId>
          <version>0.4</version>
        </plugin>
        <plugin>
          <groupId>com.mycila</groupId>
          <artifactId>license-maven-plugin</artifactId>
          <version>2.6</version>
        </plugin>
        <plugin>
          <groupId>org.sonatype.plugins</groupId>
          <artifactId>nexus-staging-maven-plugin</artifactId>
          <version>1.6.5</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>versions-maven-plugin</artifactId>
          <version>2.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-scm-plugin</artifactId>
          <version>1.9.2</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</project>
