<?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>org.clojure</groupId>
  <artifactId>pom.contrib</artifactId>
  <packaging>pom</packaging>
  <version>0.2.2</version>
  <name>pom.contrib</name>
  <description>Parent POM for projects contributed to Clojure</description>
  <url>https://github.com/clojure/build.poms</url>

  <properties>
    <!-- Builds will use this release version of Clojure, may be
         overridden in projects or at the command line. -->
    <clojure.version>1.4.0</clojure.version>
    <!-- By default, do not enable *warn-on-reflection*, may be
         overridden in projects at the command line. -->
    <clojure.warnOnReflection>false</clojure.warnOnReflection>

    <clojure.source.dir>src/main/clojure</clojure.source.dir>
    <clojure.testSource.dir>src/test/clojure</clojure.testSource.dir>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <scm>
    <connection>scm:git:git@github.com:clojure/build.poms.git</connection>
    <developerConnection>scm:git:git@github.com:clojure/build.poms.git</developerConnection>
    <url>git@github.com:clojure/build.poms.git</url>
    <tag>pom.contrib-0.2.2</tag>
  </scm>

  <licenses>
    <license>
      <name>Eclipse Public License 1.0</name>
      <url>http://opensource.org/licenses/eclipse-1.0.php</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <developers>
    <developer>
      <id>stuartsierra</id>
      <name>Stuart Sierra</name>
      <url>https://github.com/stuartsierra</url>
    </developer>
  </developers>

  <dependencies>
    <dependency>
      <groupId>org.clojure</groupId>
      <artifactId>clojure</artifactId>
      <version>${clojure.version}</version>
    </dependency>
  </dependencies>

  <distributionManagement>
    <snapshotRepository>
      <!-- This id is linked to the key setup on the CI server -->
      <id>sonatype-nexus-staging</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
  </distributionManagement>

  <build>
    <plugins>
      <plugin>
        <!-- Add Clojure sources to the project's source directories -->
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.12</version>
        <executions>
          <execution>
            <id>add-clojure-source-dirs</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
              <goal>add-resource</goal>
            </goals>
            <configuration>
              <sources>
                <source>${clojure.source.dir}</source>
              </sources>
              <resources>
                <resource>
                  <directory>${clojure.source.dir}</directory>
                </resource>
              </resources>
            </configuration>
          </execution>
          <execution>
            <id>add-clojure-test-source-dirs</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-test-source</goal>
              <goal>add-test-resource</goal>
            </goals>
            <configuration>
              <sources>
                <source>${clojure.testSource.dir}</source>
              </sources>
              <resources>
                <resource>
                  <directory>${clojure.testSource.dir}</directory>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
      <!-- By default, compile everything as a sanity check, but do
           not include any AOT-compiled .class files in the
           JAR. Projects may override as needed. -->
        <groupId>com.theoryinpractise</groupId>
        <artifactId>clojure-maven-plugin</artifactId>
        <version>1.7.1</version>
        <extensions>true</extensions>
        <configuration>
          <warnOnReflection>${clojure.warnOnReflection}</warnOnReflection>
          <temporaryOutputDirectory>true</temporaryOutputDirectory>
        </configuration>
        <executions>
          <execution>
            <id>clojure-compile</id>
            <phase>compile</phase>
            <goals>
              <goal>compile</goal>
            </goals>
          </execution>
          <execution>
            <id>clojure-test</id>
            <phase>test</phase>
            <goals>
              <goal>test</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <!-- Clojure targets Java 1.6+ -->
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.6.0</version>
          <configuration>
          <source>1.6</source>
          <target>1.6</target>
          <encoding>${project.build.sourceEncoding}</encoding>
        </configuration>
      </plugin>

      <plugin>
        <!-- do not push pre-deployment SCM changes to upstream repo
	           with maven release plugin; if the release/deploy fails,
             we're stuck with manually fixing up version numbers, git
             history, etc -->
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>2.5.3</version>
        <configuration>
          <pushChanges>false</pushChanges>
          <localCheckout>true</localCheckout>
        </configuration>
      </plugin>

      <!-- deploy artifacts to sonatype -->
      <plugin>
        <groupId>org.sonatype.plugins</groupId>
        <artifactId>nexus-staging-maven-plugin</artifactId>
        <version>1.6.7</version>
        <extensions>true</extensions>
        <configuration>
          <!-- The server "id" element from settings to use authentication from -->
          <serverId>sonatype-nexus-staging</serverId>
          <nexusUrl>https://oss.sonatype.org/</nexusUrl>
          <autoReleaseAfterClose>true</autoReleaseAfterClose>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>sign</id>
      <build>
        <plugins>
          <!-- sign artifacts for deployment -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.5</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
