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

<!--
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses />.
-->

<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>org.phenotips</groupId>
  <artifactId>phenotips-build-tools</artifactId>
  <version>1.1</version>
  <packaging>pom</packaging>

  <name>PhenoTips - Build Tools</name>
  <description>Various tools used for building PhenoTips.</description>

  <prerequisites>
    <maven>3.0.5</maven>
  </prerequisites>

  <licenses>
    <license>
      <name>AGPL 3.0</name>
      <url>https://www.gnu.org/licenses/agpl-3.0.html</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <scm>
    <connection>scm:git:git://github.com/phenotips/build-tools.git</connection>
    <developerConnection>scm:git:git@github.com:phenotips/build-tools.git</developerConnection>
    <url>https://github.com/phenotips/build-tools.git/tree/master/</url>
    <tag>1.1</tag>
  </scm>

  <organization>
    <name>University of Toronto, Computational Biology Lab</name>
    <url>http://compbio.cs.toronto.edu/</url>
  </organization>

  <distributionManagement>
    <site>
      <id>nexus.phenotips.org</id>
      <url>dav:https://nexus.phenotips.org/nexus/content/sites/site/${project.groupId}/${project.artifactId}/${project.version}</url>
    </site>
    <repository>
      <id>nexus.phenotips.org</id>
      <name>Maven2 Remote Repository for Releases</name>
      <url>https://nexus.phenotips.org/nexus/content/repositories/releases</url>
    </repository>
    <snapshotRepository>
      <id>nexus.phenotips.org</id>
      <name>Maven2 Development Repository for Snapshots</name>
      <url>https://nexus.phenotips.org/nexus/content/repositories/snapshots</url>
    </snapshotRepository>
  </distributionManagement>

  <repositories>
    <repository>
      <id>phenotips-releases</id>
      <name>PhenoTips Releases repository</name>
      <url>https://nexus.phenotips.org/nexus/content/repositories/releases/</url>
      <releases>
        <enabled>true</enabled>
        <checksumPolicy>fail</checksumPolicy>
      </releases>
      <snapshots>
        <enabled>false</enabled>
        <checksumPolicy>fail</checksumPolicy>
      </snapshots>
    </repository>
    <repository>
      <id>phenotips-snapshots</id>
      <name>PhenoTips Snapshots repository</name>
      <url>https://nexus.phenotips.org/nexus/content/repositories/snapshots/</url>
      <releases>
        <enabled>false</enabled>
        <checksumPolicy>fail</checksumPolicy>
      </releases>
      <snapshots>
        <enabled>true</enabled>
        <checksumPolicy>fail</checksumPolicy>
      </snapshots>
    </repository>
    <repository>
      <id>phenotips-externals</id>
      <name>PhenoTips external repositories mirror</name>
      <url>https://nexus.phenotips.org/nexus/content/groups/public/</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <id>phenotips-externals</id>
      <name>PhenoTips external repositories mirror</name>
      <url>https://nexus.phenotips.org/nexus/content/groups/public/</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </pluginRepository>
    <pluginRepository>
      <id>phenotips-external-snapshots</id>
      <name>PhenoTips external snapshot repositories mirror</name>
      <url>https://nexus.phenotips.org/nexus/content/groups/public-snapshots/</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </pluginRepository>
  </pluginRepositories>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <build>
    <defaultGoal>install</defaultGoal>
    <extensions>
      <extension>
        <groupId>org.apache.maven.wagon</groupId>
        <artifactId>wagon-webdav-jackrabbit</artifactId>
        <version>2.6</version>
      </extension>
    </extensions>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>2.7</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-remote-resources-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>1.5</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>2.5.2</version>
          <configuration>
            <!-- By default the release plugin will execute the "clean" and "verify" goals but won't perform an
                 "install". This is causing problems since several modules will fail to build during release:prepare.
                 See http://tinyurl.com/354vwe for more details. Thus we're forcing the execution of the "install"
                 goal. -->
            <preparationGoals>clean install</preparationGoals>
            <!-- Avoid site generation during the release:perform to speed up release process -->
            <goals>deploy</goals>
            <mavenExecutorId>forked-path</mavenExecutorId>
            <autoVersionSubmodules>true</autoVersionSubmodules>
            <localCheckout>true</localCheckout>
            <pushChanges>false</pushChanges>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-clean-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>2.6.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>3.3</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>2.4</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-install-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>2.5.2</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>2.6</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>2.10</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>3.4</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>2.18.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>2.8.2</version>
          <!-- We're deploying to Nexus using the WebDAV protocol -->
          <dependencies>
            <dependency>
              <groupId>org.apache.maven.wagon</groupId>
              <artifactId>wagon-webdav-jackrabbit</artifactId>
              <version>2.6</version>
            </dependency>
          </dependencies>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
  <profiles>
    <profile>
      <!-- Profile used when the release plugin executes. We want javadocs and source jars to be released
           + ensure we sign files using GPG. -->
      <id>release</id>
      <activation>
        <property>
          <!-- This property is automatically defined by the Maven release plugin when executing
               a release. Thus this profile will be automatically enabled when releasing -->
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.6</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
                <configuration>
                  <useAgent>true</useAgent>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <modules>
    <module>license-resources</module>
    <module>license-verification-resources</module>
    <module>codestyle-resources</module>
    <module>checkstyle-configuration</module>
  </modules>
</project>
