<?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-parent</artifactId>
  <version>1.4-rc-2</version>
  <packaging>pom</packaging>

  <prerequisites>
    <maven>3.0</maven>
  </prerequisites>

  <name>PhenoTips - Parent POM</name>
  <description>PhenoTips is a software tool providing an easy-to-use Web interface and standardized database back-end for collecting clinical symptoms and physical findings observed in patients with genetic disorders.</description>
  <url>http://phenotips.org/</url>
  <inceptionYear>2011</inceptionYear>

  <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/phenotips.git</connection>
    <developerConnection>scm:git:git@github.com:phenotips/phenotips.git</developerConnection>
    <url>https://github.com/phenotips/phenotips.git/tree/master/</url>
    <tag>phenotips-1.4-rc-2</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>
    <phenotips.version>1.4-rc-2</phenotips.version>
    <project.version.previous>1.3</project.version.previous>
    <xwiki.version>7.4.6</xwiki.version>
    <slf4j.version>1.7.22</slf4j.version>
    <poi.version>3.11</poi.version>
    <selenium.version>2.53.1</selenium.version>
    <jackson.codehaus.version>1.9.13</jackson.codehaus.version>
    <jackson.fasterxml.version>2.8.6</jackson.fasterxml.version>
    <restlet.version>2.0.15</restlet.version>
    <buildtools.version>1.8</buildtools.version>
    <textAnalysis.version>1.0-rc-1</textAnalysis.version>
    <testframework.version>1.3</testframework.version>
    <solr.version>6.5.1</solr.version>
    <jaxb2-fluent-api.version>3.0</jaxb2-fluent-api.version>
    <maven-jaxb2-plugin.version>0.13.3</maven-jaxb2-plugin.version>
    <enforcer.skip>false</enforcer.skip>
    <checkstyle.skip>false</checkstyle.skip>
    <!-- Clirr doesn't work well on Java 8 unfortunately... -->
    <clirr.skip>true</clirr.skip>
    <license.skip>false</license.skip>
    <dependencyCheck.skip>false</dependencyCheck.skip>
    <coverage.instructionRatio>1.00</coverage.instructionRatio>

    <!-- Functional test environment -->
    <xwiki.defaultSkin>PhenoTips.Skin</xwiki.defaultSkin>
    <it.pattern>.*</it.pattern>
    <it.patternMethod>.*</it.patternMethod>
    <it.server.directory>${project.build.directory}/package/</it.server.directory>
    <it.server.port>8080</it.server.port>
    <it.server.stopPort>8079</it.server.stopPort>
    <it.server.startCommand>sh start.sh ${it.server.port} ${it.server.stopPort}</it.server.startCommand>
    <it.server.stopCommand>sh stop.sh ${it.server.stopPort}</it.server.stopCommand>
    <it.server.baseURL>http://localhost</it.server.baseURL>
  </properties>

  <dependencyManagement>
    <dependencies>
      <!-- Apache Commons -->
      <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.6</version>
      </dependency>
      <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-text</artifactId>
        <version>1.1</version>
      </dependency>
      <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-collections4</artifactId>
        <version>4.1</version>
      </dependency>
      <dependency>
        <groupId>commons-collections</groupId>
        <artifactId>commons-collections</artifactId>
        <version>3.2.2</version>
      </dependency>
      <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-csv</artifactId>
        <version>1.4</version>
      </dependency>
      <!-- Everybody logs -->
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${slf4j.version}</version>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</artifactId>
        <version>${slf4j.version}</version>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>log4j-over-slf4j</artifactId>
        <version>${slf4j.version}</version>
      </dependency>
      <!-- Logging framework -->
      <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>1.1.9</version>
      </dependency>
      <!-- Most plugins depend on the servlet API -->
      <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.0.1</version>
        <!-- It should always be provided, otherwise containers will complain about it. -->
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time</artifactId>
        <version>2.9.7</version>
      </dependency>
      <!-- JSON serialization and deserialization -->
      <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20160810</version>
      </dependency>
      <!-- Exclude XWiki's Solr search modules -->
      <dependency>
        <groupId>org.xwiki.platform</groupId>
        <artifactId>xwiki-platform-repository-server-api</artifactId>
        <version>${xwiki.version}</version>
        <exclusions>
          <exclusion>
            <groupId>org.xwiki.platform</groupId>
            <artifactId>xwiki-platform-search-solr-query</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <!-- HTTP libraries -->
      <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpcore</artifactId>
        <version>4.4.5</version>
      </dependency>
      <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.5.2</version>
        <exclusions>
          <exclusion>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpasyncclient</artifactId>
        <version>4.1.2</version>
        <exclusions>
          <exclusion>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>rome</groupId>
        <artifactId>rome</artifactId>
        <version>1.0</version>
        <exclusions>
          <exclusion>
            <!-- We're using the newer org.jdom:jdom -->
            <groupId>jdom</groupId>
            <artifactId>jdom</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <!-- Other commons libraries -->
      <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <version>1.10</version>
      </dependency>
      <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.5</version>
      </dependency>
      <!-- Use the latest Selenium version for browser compatibility -->
      <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-api</artifactId>
        <version>${selenium.version}</version>
      </dependency>
      <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-support</artifactId>
        <version>${selenium.version}</version>
      </dependency>
      <!-- Use a more recent version of Jackson 1.x, the latest compatible with the version of restlet in use -->
      <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-core-asl</artifactId>
        <version>${jackson.codehaus.version}</version>
      </dependency>
      <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-mapper-asl</artifactId>
        <version>${jackson.codehaus.version}</version>
      </dependency>
      <!-- Use a more recent version of Jackson 2.x -->
      <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-core</artifactId>
        <version>${jackson.fasterxml.version}</version>
      </dependency>
      <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>${jackson.fasterxml.version}</version>
      </dependency>
      <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-annotations</artifactId>
        <version>${jackson.fasterxml.version}</version>
      </dependency>
      <!-- REST -->
      <dependency>
        <groupId>javax.ws.rs</groupId>
        <artifactId>jsr311-api</artifactId>
        <version>1.0</version>
      </dependency>
      <dependency>
        <groupId>org.restlet.jse</groupId>
        <artifactId>org.restlet</artifactId>
        <version>${restlet.version}</version>
      </dependency>
      <dependency>
        <groupId>org.restlet.jse</groupId>
        <artifactId>org.restlet.ext.jackson</artifactId>
        <version>${restlet.version}</version>
      </dependency>
      <dependency>
        <groupId>org.restlet.jse</groupId>
        <artifactId>org.restlet.ext.jaxrs</artifactId>
        <version>${restlet.version}</version>
        <exclusions>
          <exclusion>
            <groupId>org.restlet.jse</groupId>
            <artifactId>org.restlet.lib.org.json</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <!-- TEST -->
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <version>1.10.19</version>
        <scope>test</scope>
      </dependency>
        <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>3.6.9.Final</version>
      </dependency>
      <!-- Security -->
      <dependency>
        <groupId>org.jasypt</groupId>
        <artifactId>jasypt</artifactId>
        <version>1.9.2</version>
      </dependency>
      <!-- Database connectors for MySQL and HSQLDB, the most commonly used ones. -->
      <dependency>
        <groupId>org.hsqldb</groupId>
        <artifactId>hsqldb</artifactId>
        <version>2.3.4</version>
      </dependency>
      <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.40</version>
      </dependency>
      <!-- XWiki dependencies -->
      <!-- Make sure to include the proper version of antlr for hibernate-core -->
      <dependency>
        <groupId>antlr</groupId>
        <artifactId>antlr</artifactId>
        <version>2.7.6</version>
      </dependency>
      <!-- The new version of HTMLCleaner is required for PDFs to work properly -->
      <dependency>
        <groupId>net.sourceforge.htmlcleaner</groupId>
        <artifactId>htmlcleaner</artifactId>
        <version>2.18</version>
      </dependency>
      <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>14.0.1</version>
      </dependency>
      <dependency>
        <groupId>com.google.code.findbugs</groupId>
        <artifactId>annotations</artifactId>
        <version>3.0.1u2</version>
      </dependency>
      <dependency>
        <groupId>de.charite.compbio</groupId>
        <artifactId>ontologizer-core</artifactId>
        <version>2.1.2</version>
      </dependency>
      <dependency>
        <groupId>de.charite.compbio</groupId>
        <artifactId>ontologizer-benchmark</artifactId>
        <version>2.1.2</version>
      </dependency>
      <!-- Batik 1.8 is used, but css4j pulls in a few 1.7 modules; force 1.8 throughout -->
      <dependency>
        <groupId>org.apache.xmlgraphics</groupId>
        <artifactId>batik-util</artifactId>
        <version>1.8</version>
      </dependency>
      <dependency>
        <groupId>org.apache.xmlgraphics</groupId>
        <artifactId>batik-css</artifactId>
        <version>1.8</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <defaultGoal>install</defaultGoal>
    <extensions>
      <extension>
        <groupId>org.apache.maven.wagon</groupId>
        <artifactId>wagon-webdav-jackrabbit</artifactId>
        <version>2.6</version>
      </extension>
      <!-- Adds support for the "functional-tests" packaging -->
      <extension>
        <groupId>org.phenotips</groupId>
        <artifactId>phenotips-functional-tests-lifecycle</artifactId>
        <version>${testframework.version}</version>
      </extension>
      <!-- Adds support for the "xar" packaging -->
      <extension>
        <groupId>org.xwiki.commons</groupId>
        <artifactId>xwiki-commons-tool-xar-handlers</artifactId>
        <version>${xwiki.version}</version>
      </extension>
    </extensions>
    <plugins>
      <!-- Show compiler warnings -->
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <compilerArgument>-Xlint:all</compilerArgument>
          <showWarnings>true</showWarnings>
          <showDeprecation>true</showDeprecation>
        </configuration>
      </plugin>

      <plugin>
        <!-- Run Checkstyle -->
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
      </plugin>
      <plugin>
        <!-- Check license headers -->
        <groupId>com.mycila</groupId>
        <artifactId>license-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <!-- API backwards compatibility check -->
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>clirr-maven-plugin</artifactId>
        <configuration>
          <comparisonVersion>${project.version.previous}</comparisonVersion>
          <!-- List of specific CLIRR excludes.
               See http://www.mojohaus.org/clirr-maven-plugin/examples/ignored-differences.html
          -->
          <ignored>
            <!-- Remove the following ignores after we release 1.4 -->
            <difference>
              <className>org/phenotips/vocabulary/SolrVocabularyResourceManager</className>
              <differenceType>7012</differenceType>
              <method>void createReplacementCore(java.lang.String)</method>
              <justification>New methods for safe vocabulary reindexing.</justification>
            </difference>
            <difference>
              <className>org/phenotips/vocabulary/SolrVocabularyResourceManager</className>
              <differenceType>7012</differenceType>
              <method>void replaceCore(java.lang.String)</method>
              <justification>New methods for safe vocabulary reindexing.</justification>
            </difference>
            <difference>
              <className>org/phenotips/vocabulary/SolrVocabularyResourceManager</className>
              <differenceType>7012</differenceType>
              <method>org.apache.solr.client.solrj.SolrClient getReplacementSolrConnection(java.lang.String)</method>
              <justification>New methods for safe vocabulary reindexing.</justification>
            </difference>
            <difference>
              <className>org/phenotips/vocabulary/SolrVocabularyResourceManager</className>
              <differenceType>7012</differenceType>
              <method>void discardReplacementCore(java.lang.String)</method>
              <justification>New methods for safe vocabulary reindexing.</justification>
            </difference>
            <difference>
              <className>org/phenotips/vocabulary/VocabularyManager</className>
              <differenceType>7012</differenceType>
              <method>java.util.List search(java.lang.String, java.lang.String, int)</method>
              <justification>Adding support for searches in vocabulary category</justification>
            </difference>
            <difference>
              <className>org/phenotips/vocabulary/VocabularyManager</className>
              <differenceType>7012</differenceType>
              <method>java.util.List search(java.lang.String, java.lang.String, int, java.lang.String, java.lang.String)</method>
              <justification>Adding support for searches in vocabulary category</justification>
            </difference>
            <difference>
              <className>org/phenotips/vocabulary/VocabularyManager</className>
              <differenceType>7012</differenceType>
              <method>java.util.List getAvailableCategories()</method>
              <justification>New method to get a list of all available vocabulary categories.</justification>
            </difference>
            <difference>
              <className>org/phenotips/vocabulary/VocabularyManager</className>
              <differenceType>7012</differenceType>
              <method>java.util.Set getVocabularies(java.lang.String)</method>
              <justification>New method to get a list of all vocabularies that fall under some category.</justification>
            </difference>
            <difference>
              <className>org/phenotips/vocabulary/VocabularyManager</className>
              <differenceType>7012</differenceType>
              <method>boolean hasCategory(java.lang.String)</method>
              <justification>New method that returns true iff a category name is valid.</justification>
            </difference>
            <difference>
              <className>org/phenotips/vocabulary/VocabularyManager</className>
              <differenceType>7012</differenceType>
              <method>boolean hasVocabulary(java.lang.String)</method>
              <justification>New method that returns true iff a vocabulary id is valid.</justification>
            </difference>
            <difference>
              <className>org/phenotips/data/permissions/script/PermissionsManagerScriptService</className>
              <differenceType>7005</differenceType>
              <method>org.phenotips.data.permissions.PatientAccess getPatientAccess(org.phenotips.data.Patient)</method>
              <to>org.phenotips.data.permissions.PatientAccess getPatientAccess(java.lang.String)</to>
              <justification>after SecurePatient update this service now needs to get its own non-read-only copy of a patient</justification>
            </difference>
            <difference>
              <className>org/phenotips/configuration/Record*</className>
              <differenceType>7012</differenceType>
              <method>void set*(*)</method>
              <justification>New API methods needed for making the configuration more extensible.</justification>
            </difference>
            <difference>
              <className>org/phenotips/configuration/RecordConfigurationManager</className>
              <differenceType>7012</differenceType>
              <method>org.phenotips.configuration.RecordConfiguration getConfiguration(java.lang.String)</method>
              <justification>New API methods needed for making the configuration more extensible.</justification>
              <className>org/phenotips/vocabulary/Vocabulary</className>
              <differenceType>7012</differenceType>
              <method>java.util.Collection getSupportedCategories()</method>
              <justification>Adding support for vocabulary categories</justification>
            </difference>
            <difference>
              <className>org/phenotips/vocabulary/Vocabulary</className>
              <differenceType>7012</differenceType>
              <method>java.util.List search(java.lang.String, java.lang.String, int, java.lang.String, java.lang.String)</method>
              <justification>Adding support for vocabulary categories</justification>
            </difference>
            <difference>
              <className>org/phenotips/groups/GroupManager</className>
              <differenceType>7012</differenceType>
              <method>java.util.List getAllMembersForGroup(java.lang.String)</method>
              <justification>Adding new method to get all members of the group</justification>
            </difference>
            <difference>
              <className>org/phenotips/data/permissions/internal</className>
              <differenceType>7012</differenceType>
              <method>com.xpn.xwiki.api.Document getDocument(org.xwiki.model.reference.EntityReference)</method>
              <justification>Adding new method to get Document of user or group reference</justification>
            </difference>
          </ignored>
          <excludes>
            <exclude>**/internal/**</exclude>
            <exclude>**/test/**</exclude>
            <!-- Remove the following excludes after we release the current version as final -->
          </excludes>
        </configuration>
      </plugin>
      <!-- We want to force packaging the license resources in the produced XWiki artifacts -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-remote-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>license-resources</id>
            <goals>
              <goal>process</goal>
            </goals>
            <configuration>
              <resourceBundles>
                <resourceBundle>org.phenotips:phenotips-license-resources:${buildtools.version}</resourceBundle>
              </resourceBundles>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!-- Check that declared dependencies match what's actually used -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>check-dependencies</id>
            <goals>
              <goal>analyze-only</goal>
            </goals>
            <configuration>
              <failOnWarning>true</failOnWarning>
              <ignoreNonCompile>true</ignoreNonCompile>
              <skip>${dependencyCheck.skip}</skip>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!-- Fail the build if the test coverage is below a given value. -->
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.7.9</version>
        <executions>
          <execution>
            <id>jacoco-prepare</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>jacoco-check</id>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <rules>
            <rule>
              <limits>
                <limit>
                  <counter>INSTRUCTION</counter>
                  <minimum>${coverage.instructionRatio}</minimum>
                </limit>
              </limits>
            </rule>
          </rules>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <dependencies>
          <dependency>
            <groupId>org.xwiki.commons</groupId>
            <artifactId>xwiki-commons-tool-enforcer-dependencies</artifactId>
            <version>${xwiki.version}</version>
          </dependency>
        </dependencies>
        <executions>
          <!-- Check that all Maven plugins have versions defined -->
          <execution>
            <id>enforce-plugins</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requirePluginVersions>
                  <message>Best Practice is to always define plugin versions!</message>
                  <banLatest>false</banLatest>
                  <banRelease>false</banRelease>
                  <banSnapshots>false</banSnapshots>
                </requirePluginVersions>
              </rules>
            </configuration>
          </execution>
          <!-- Check that we're using commons-lang3 and not commons-lang -->
          <execution>
            <id>enforce-commons-lang3</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <bannedDependencies>
                  <searchTransitive>false</searchTransitive>
                  <message>
                    Best practice is to use Commons Lang 3.x
                  </message>
                  <excludes>
                    <exclude>commons-lang:commons-lang</exclude>
                  </excludes>
                </bannedDependencies>
              </rules>
            </configuration>
          </execution>
          <execution>
            <id>enforce-no-legacy-dependencies</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <xwikiBannedDependencies implementation="org.xwiki.tool.enforcer.XWikiBannedDependencies">
                  <searchTransitive>true</searchTransitive>
                  <message>Don't depend on a XWiki Legacy module!</message>
                  <excludes>
                    <exclude>.*xwiki.*:.*-legacy-.*</exclude>
                  </excludes>
                </xwikiBannedDependencies>
              </rules>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <skip>${enforcer.skip}</skip>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <executions>
          <execution>
            <id>generate-javadocs</id>
            <goals>
              <goal>javadoc</goal>
            </goals>
            <phase>prepare-package</phase>
          </execution>
        </executions>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>1.4.1</version>
        </plugin>
        <!-- Apply checkstyle rules and fail the build in case of errors. The checkstyle config
             files are taken from the build-tools JAR module.-->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>2.17</version>
          <dependencies>
            <dependency>
              <groupId>com.puppycrawl.tools</groupId>
              <artifactId>checkstyle</artifactId>
              <version>7.2</version>
            </dependency>
            <dependency>
              <groupId>org.phenotips</groupId>
              <artifactId>phenotips-checkstyle-configuration</artifactId>
              <version>${buildtools.version}</version>
            </dependency>
          </dependencies>
          <configuration>
            <consoleOutput>true</consoleOutput>
            <skip>${checkstyle.skip}</skip>
            <configLocation>checkstyle.xml</configLocation>
          </configuration>
          <executions>
            <execution>
              <id>source-checkstyle</id>
              <goals>
                <goal>check</goal>
              </goals>
            </execution>
            <execution>
              <id>test-checkstyle</id>
              <goals>
                <goal>check</goal>
              </goals>
              <configuration>
                <configLocation>test-checkstyle.xml</configLocation>
                <includeTestSourceDirectory>true</includeTestSourceDirectory>
                <sourceDirectory>src/test/java/</sourceDirectory>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <!-- Check license headers and fail the build if they're missing or not matching the defined format -->
        <plugin>
          <groupId>com.mycila</groupId>
          <artifactId>license-maven-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>3.0</version>
          <configuration>
            <skip>${license.skip}</skip>
            <header>license.txt</header>
            <strictCheck>true</strictCheck>
            <headerDefinitions>
              <!-- Our style for XML headers isn't standard so we need to define it in a custom manner.
                   See xwiki-commons-tool-validation-resources module -->
              <headerDefinition>license-xml-definition.xml</headerDefinition>
              <headerDefinition>license-script-definition.xml</headerDefinition>
              <headerDefinition>license-batch-definition.xml</headerDefinition>
            </headerDefinitions>
            <!-- Our Java and XML styles aren't the default so we need to change the mapping -->
            <mapping>
              <java>SLASHSTAR_STYLE</java>
              <aj>SLASHSTAR_STYLE</aj>
            </mapping>
            <!-- We're only interested in checking our sources and our POMs -->
            <!-- At the moment, only check the license headers in Java, XML and shell script files -->
            <!-- FIXME: fix other types of files as well -->
            <includes>
              <include>src/**/*.java</include>
              <include>src/**/*.xml</include>
              <include>src/**/*.bat</include>
              <include>src/**/*.sh</include>
              <include>pom.xml</include>
            </includes>
            <excludes>
              <!-- At the moment we don't have a comment syntax for components.txt files so we need to exclude them
                   from the check -->
              <exclude>**/components.txt</exclude>
              <exclude>**/component-overrides.txt</exclude>
              <!-- Since there's no comment syntax for Maven IT tests's goal.txt file we need to exclude it -->
              <exclude>**/it/**/goals.txt</exclude>
              <exclude>**/goal.txt</exclude>
              <!-- Exclude sample patient records -->
              <exclude>**/P0*.xml</exclude>
              <exclude>**/F0*.xml</exclude>
            </excludes>
            <useDefaultExcludes>false</useDefaultExcludes>
          </configuration>
          <!-- Add a dependency since this is where the maven-license-plugin plugin will find the license.txt file -->
          <dependencies>
            <dependency>
              <groupId>org.phenotips</groupId>
              <artifactId>phenotips-license-verification-resources</artifactId>
              <version>${buildtools.version}</version>
            </dependency>
          </dependencies>
          <executions>
            <execution>
              <goals>
                <goal>check</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>3.0.2</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.3</version>
          <configuration>
            <arguments>-Pquick</arguments>
            <!-- 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>
            <tagNameFormat>phenotips-@{project.version}</tagNameFormat>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-clean-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>3.0.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>3.0.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-plugin-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>3.5</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-compiler-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>3.6.1</version>
          <!-- Java 1.8 is required -->
          <configuration>
            <source>1.8</source>
            <target>1.8</target>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>2.19.1</version>
          <!-- Rule is to put tests in *Test classes -->
          <configuration>
            <includes>
              <include>**/*Test.class</include>
            </includes>
            <parallel>classesAndMethods</parallel>
            <threadCount>2</threadCount>
            <systemProperties>
              <property>
                <name>pattern</name>
                <value>${it.pattern}</value>
              </property>
              <property>
                <name>patternMethod</name>
                <value>${it.patternMethod}</value>
              </property>
              <property>
                <name>xwiki.test.baseURL</name>
                <value>${it.server.baseURL}</value>
              </property>
              <property>
                <name>xwiki.test.skipStart</name>
                <value>${it.skipStart}</value>
              </property>
              <property>
                <name>xwikiPort</name>
                <value>${it.server.port}</value>
              </property>
              <property>
                <name>xwikiStopPort</name>
                <value>${it.server.stopPort}</value>
              </property>
              <property>
                <name>xwikiExecutionDirectory</name>
                <value>${it.server.directory}</value>
              </property>
              <property>
                <name>screenshotDirectory</name>
                <value>${basedir}/target/screenshots</value>
              </property>
              <property>
                <name>xwikiExecutionStartCommand</name>
                <value>${it.server.startCommand}</value>
              </property>
              <property>
                <name>xwikiExecutionStopCommand</name>
                <value>${it.server.stopCommand}</value>
              </property>
              <property>
                <name>xwikiWebappName</name>
                <value>phenotips</value>
              </property>
              <property>
                <name>xwikiWebappPath</name>
                <value />
              </property>
            </systemProperties>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>3.0.2</version>
          <configuration>
            <!-- Add some useful information about the extension in the manifest file. -->
            <archive>
              <manifestEntries>
                <XWiki-Extension-Id>${project.groupId}:${project.artifactId}</XWiki-Extension-Id>
              </manifestEntries>
            </archive>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-assembly-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>3.0.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>3.0.0</version>
          <configuration>
            <ignoredUsedUndeclaredDependencies>
              <ignoredUsedUndeclaredDependency>javax.inject:javax.inject</ignoredUsedUndeclaredDependency>
              <ignoredUsedUndeclaredDependency>org.xwiki.commons:xwiki-commons-stability</ignoredUsedUndeclaredDependency>
              <ignoredUsedUndeclaredDependency>org.mockito:mockito-core</ignoredUsedUndeclaredDependency>
              <ignoredUsedUndeclaredDependency>junit:junit</ignoredUsedUndeclaredDependency>
              <ignoredUsedUndeclaredDependency>org.hamcrest:hamcrest-library</ignoredUsedUndeclaredDependency>
            </ignoredUsedUndeclaredDependencies>
            <ignoredUnusedDeclaredDependencies>
              <ignoredUnusedDeclaredDependency>javax.servlet:javax.servlet-api</ignoredUnusedDeclaredDependency>
            </ignoredUnusedDeclaredDependencies>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-war-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>3.0.0</version>
          <configuration>
            <!-- Add some useful information about the extension in the manifest file. -->
            <archive>
              <manifestEntries>
                <XWiki-Extension-Id>${project.groupId}:${project.artifactId}</XWiki-Extension-Id>
              </manifestEntries>
            </archive>
          </configuration>
        </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>
          <!-- This doesn't currently work on Jenkins...
          <configuration>
            <deployAtEnd>true</deployAtEnd>
          </configuration>
          -->
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-project-info-reports-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>2.9</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>clirr-maven-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>2.8</version>
          <executions>
            <execution>
              <id>clirr-check</id>
              <goals>
                <goal>check</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <comparisonVersion>${clirr.previous.version}</comparisonVersion>
            <skip>${clirr.skip}</skip>
            <!-- The list of excluded files and ignored changes is configured way above, in the <plugins> section. -->
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>1.6</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>2.10.4</version>
          <configuration>
            <!-- Always exclude the internal package since it's not user-public -->
            <excludePackageNames>*.internal.*</excludePackageNames>
            <!-- Make sure javadoc has enough memory -->
            <maxmemory>300m</maxmemory>
            <taglets>
              <taglet>
                <tagletClass>org.phenotips.tools.javadoc.NoteTaglet</tagletClass>
              </taglet>
              <taglet>
                <tagletClass>org.phenotips.tools.javadoc.TodoTaglet</tagletClass>
              </taglet>
              <taglet>
                <tagletClass>org.phenotips.tools.javadoc.FixmeTaglet</tagletClass>
              </taglet>
              <taglet>
                <tagletClass>org.phenotips.tools.javadoc.WarningTaglet</tagletClass>
              </taglet>
            </taglets>
            <tagletArtifact>
              <groupId>${project.groupId}</groupId>
              <artifactId>phenotips-taglets</artifactId>
              <version>${buildtools.version}</version>
            </tagletArtifact>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>3.6</version>
          <!-- Site Plugin doesn't automatically pull the Apache Wagon implementation -->
          <dependencies>
            <dependency>
              <groupId>org.apache.maven.wagon</groupId>
              <artifactId>wagon-webdav-jackrabbit</artifactId>
              <version>2.6</version>
            </dependency>
          </dependencies>
          <configuration>
            <reportPlugins>
              <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>2.7</version>
                <configuration>
                  <!-- Since contacting the Maven Repositories can take a very long time, tell the plugin not to display
                       the repository locations of the dependencies in the report. -->
                  <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
                </configuration>
                <reports>
                  <report>summary</report>
                  <report>index</report>
                  <report>dependencies</report>
                  <report>dependency-convergence</report>
                  <report>mailing-list</report>
                  <report>issue-tracking</report>
                  <report>scm</report>
                </reports>
              </plugin>
              <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.9.1</version>
                <configuration>
                  <!-- Always exclude the internal package since it's not user-public -->
                  <excludePackageNames>*.internal.*</excludePackageNames>
                  <!-- Make sure javadoc has enough memory -->
                  <maxmemory>300m</maxmemory>
                </configuration>
                <!-- Don't generate test javadoc -->
                <reports>
                  <report>javadoc</report>
                </reports>
              </plugin>
            </reportPlugins>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.xwiki.commons</groupId>
          <artifactId>xwiki-commons-tool-xar-plugin</artifactId>
          <version>${xwiki.version}</version>
        </plugin>
        <plugin>
          <groupId>org.phenotips</groupId>
          <artifactId>phenotips-packager-maven-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>${testframework.version}</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>exec-maven-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>1.5.0</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <!-- Lock down plugin version for build reproducibility -->
          <version>1.12</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <profiles>
    <profile>
      <!-- Use this ( mvn install -Pquick ) when trying to get a quicker test build, without running any quality control checks. -->
      <id>quick</id>
      <properties>
        <enforcer.skip>true</enforcer.skip>
        <checkstyle.skip>true</checkstyle.skip>
        <clirr.skip>true</clirr.skip>
        <jacoco.skip>true</jacoco.skip>
        <skipTests>true</skipTests>
        <license.skip>true</license.skip>
        <xar.verify.skip>true</xar.verify.skip>
        <dependencyCheck.skip>true</dependencyCheck.skip>
      </properties>
    </profile>

    <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-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <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>
                <configuration>
                  <useAgent>true</useAgent>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- Test profiles -->
    <profile>
      <id>windows</id>
      <activation>
        <os>
          <family>windows</family>
        </os>
      </activation>
      <properties>
        <it.server.startCommand>cmd /c start.bat ${it.server.port} ${it.server.stopPort}</it.server.startCommand>
        <it.server.stopCommand>cmd /c stop.bat ${it.server.stopPort}</it.server.stopCommand>
      </properties>
    </profile>
  </profiles>

  <modules>
    <module>resources</module>
    <module>components</module>
    <module>distribution</module>
  </modules>
</project>
