<?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>
  <parent>
    <groupId>org.sonatype.oss</groupId>
    <artifactId>oss-parent</artifactId>
    <version>7</version>
  </parent>
  <groupId>org.wikidata.query.rdf</groupId>
  <artifactId>parent</artifactId>
  <version>0.1.3</version>
  <packaging>pom</packaging>

  <modules>
    <module>testTools</module>
    <module>common</module>
    <module>blazegraph</module>
    <module>tools</module>
    <module>war</module>
    <module>dist</module>
  </modules>

  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <developers>
    <developer>
      <id>manybubbles</id>
      <name>Nik Everett</name>
      <email>nik9000+wikidata@gmail.com</email>
      <timezone>America/New York</timezone>
    </developer>
    <developer>
      <id>smalyshev</id>
      <name>Stas Malyshev</name>
      <email>smalsyhev@wikimedia.org</email>
      <timezone>America/Los Angeles</timezone>
    </developer>
  </developers>

  <scm>
    <url>https://gerrit.wikimedia.org/r/#/admin/projects/wikidata/query/rdf</url>
    <connection>scm:git:https://gerrit.wikimedia.org/r/wikidata/query/rdf</connection>
    <developerConnection>scm:git:https://gerrit.wikimedia.org/r/wikidata/query/rdf</developerConnection>
  </scm>

  <issueManagement>
    <system>Phabricator</system>
    <url><![CDATA[https://phabricator.wikimedia.org/maniphest/?statuses=open%2Cstalled&allProjects=PHID-PROJ-ceqceb2bnio6alj5nxov#R]]></url>
  </issueManagement>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <blazegraph.version>1.5.3-wmf-3</blazegraph.version>
    <!-- This Blazegraph version has backports onto the 1.5.1 branch and is hosted at WMF. Documentation on how to do that
      is in the backport_blazegraph.txt file. -->
    <sesame.version>2.8.1</sesame.version>
  </properties>

  <distributionManagement>
    <snapshotRepository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
    <repository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
  </distributionManagement>

  <build>
    <resources>
      <!-- Allows for resources to live along side java files. The non-standard standard. -->
      <resource>
        <directory>src/main/resources</directory>
      </resource>
      <resource>
        <directory>src/main/java</directory>
        <includes>
          <include>**</include>
        </includes>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </resource>
    </resources>
    <testResources>
      <!-- Allows for resources to live along side java files. The non-standard standard. -->
      <testResource>
        <directory>src/test/resources</directory>
      </testResource>
      <testResource>
        <directory>src/test/java</directory>
        <includes>
          <include>**</include>
        </includes>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </testResource>
    </testResources>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.sonatype.plugins</groupId>
          <artifactId>nexus-staging-maven-plugin</artifactId>
          <version>1.6.3</version>
          <extensions>true</extensions>
          <configuration>
            <serverId>ossrh</serverId>
            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
            <autoReleaseAfterClose>true</autoReleaseAfterClose>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>2.3.2</version>
          <configuration>
            <source>1.7</source>
            <target>1.7</target>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-clean-plugin</artifactId>
          <version>2.4.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>2.5</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-install-plugin</artifactId>
          <version>2.3.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>2.3.2</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.5</version>
          <configuration>
            <pushChanges>false</pushChanges>
            <autoVersionSubmodules>true</autoVersionSubmodules>
            <useReleaseProfile>false</useReleaseProfile>
            <releaseProfiles>release</releaseProfiles>
            <goals>deploy</goals>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <configuration>
            <skipTests>true</skipTests>
          </configuration>
        </plugin>
        <plugin>
          <groupId>com.carrotsearch.randomizedtesting</groupId>
          <artifactId>junit4-maven-plugin</artifactId>
          <version>2.1.13</version>
          <configuration>
            <heartbeat>20</heartbeat>
            <jvmOutputAction>pipe,warn</jvmOutputAction>
            <leaveTemporary>true</leaveTemporary>
            <assertions>
              <enable />
            </assertions>
            <seed>${tests.seed}</seed>
            <jvmArgs>
              <param>-Xmx512m</param>
            </jvmArgs>
          </configuration>
          <executions>
            <execution>
              <id>tests</id>
              <phase>test</phase>
              <goals>
                <goal>junit4</goal>
              </goals>
              <configuration>
                <includes>
                  <include>**/*UnitTest.class</include>
                </includes>
                <excludes>
                  <exclude>**/*IntegrationTest.class</exclude>
                </excludes>
                <!-- Use as many JVMs as the test runner wants to use. -->
                <parallelism>auto</parallelism>
                <!-- The listeners and balancers elements do three things: 1. Control how output is formatted during tests
                  2. Dump the report to the right spot 3. Log an "execution-hints" file that is used to balance the load when tests are forked. -->
                <listeners>
                  <report-ant-xml mavenExtensions="true" dir="${project.build.directory}/surefire-reports" />
                  <report-text showThrowable="true" showStackTraces="true" showOutput="onerror"
                    showStatusOk="false" showStatusError="true" showStatusFailure="true" showStatusIgnored="true"
                    showSuiteSummary="true" timestamps="true" />
                  <report-execution-times historyLength="20"
                    file="${basedir}/.execution-hints-${project.version}.log" />
                </listeners>
                <balancers>
                  <execution-times>
                    <fileset dir="${basedir}" includes="${basedir}/.execution-hints-${project.version}.log" />
                  </execution-times>
                </balancers>
              </configuration>
            </execution>
            <execution>
              <id>integration-tests</id>
              <phase>integration-test</phase>
              <goals>
                <goal>junit4</goal>
              </goals>
              <configuration>
                <includes>
                  <include>**/*IntegrationTest.class</include>
                </includes>
                <excludes>
                  <exclude>**/*UnitTest.class</exclude>
                </excludes>
                <!-- Use only a single JVM so we don't interfere with ourselves. -->
                <parallelism>1</parallelism>
                <listeners>
                  <report-ant-xml mavenExtensions="true" dir="${project.build.directory}/failsafe-reports" />
                  <report-text showThrowable="true" showStackTraces="true" showOutput="onerror"
                    showStatusOk="false" showStatusError="true" showStatusFailure="true" showStatusIgnored="true"
                    showSuiteSummary="true" timestamps="true" />
                </listeners>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>2.2.1</version>
          <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>
          <version>2.9.1</version>
          <executions>
            <execution>
              <id>attach-javadocs</id>
              <goals>
                <goal>jar</goal>
              </goals>
              <configuration>
                <quiet>true</quiet>
                <!-- We don't want Java 8's strict javadoc checking so we use this trick borrowed from dropwizard to turn
                  it off -->
                <additionalparam>${javadoc.doclint.none}</additionalparam>
                <excludePackageNames>com.bigdata.rdf.internal</excludePackageNames>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <version>2.13</version>
          <executions>
            <execution>
              <id>validate</id>
              <phase>test</phase>
              <configuration>
                <configLocation>${project.parent.basedir}/src/build/checkstyle/checkstyle.xml</configLocation>
                <propertyExpansion>checkstyle.suppressions=${project.parent.basedir}/src/build/checkstyle/suppressions.xml</propertyExpansion>
                <includeTestSourceDirectory>true</includeTestSourceDirectory>
                <encoding>UTF-8</encoding>
                <consoleOutput>true</consoleOutput>
                <failsOnError>true</failsOnError>
                <linkXRef>false</linkXRef>
              </configuration>
              <goals>
                <goal>check</goal>
              </goals>
            </execution>
          </executions>
          <dependencies>
            <dependency>
              <groupId>com.puppycrawl.tools</groupId>
              <artifactId>checkstyle</artifactId>
              <version>6.2</version>
            </dependency>
          </dependencies>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>de.thetaphi</groupId>
        <artifactId>forbiddenapis</artifactId>
        <version>1.7</version>
        <configuration>
          <targetVersion>1.7</targetVersion>
          <failOnMissingClasses>false</failOnMissingClasses> <!-- this is a bug in forbidden APIs since 1.5 looks also at annotations -->
          <!-- disallow undocumented classes like sun.misc.Unsafe: -->
          <internalRuntimeForbidden>true</internalRuntimeForbidden>
          <bundledSignatures>
            <!-- This will automatically choose the right signatures based on 'maven.compiler.target': -->
            <bundledSignature>jdk-unsafe</bundledSignature>
            <bundledSignature>jdk-deprecated</bundledSignature>
            <bundledSignaure>jdk-system-out</bundledSignaure>
          </bundledSignatures>
        </configuration>
        <executions>
          <execution>
            <id>check-forbidden-apis</id>
            <phase>compile</phase>
            <goals>
              <goal>check</goal>
            </goals>
            <configuration>
              <signaturesFiles>
                <signaturesFile>${project.parent.basedir}/src/build/forbidden/all.txt</signaturesFile>
                <signaturesFile>${project.parent.basedir}/src/build/forbidden/core.txt</signaturesFile>
              </signaturesFiles>
              <excludes>
                <!-- Some portions of the project need access to System.out and things so we contain them in inner classes
                  of this form. -->
                <exclude>**/*$ForbiddenOk**.class</exclude>
              </excludes>
            </configuration>
          </execution>
          <execution>
            <id>check-forbidden-test-apis</id>
            <phase>test-compile</phase>
            <goals>
              <goal>testCheck</goal>
            </goals>
            <configuration>
              <signaturesFiles>
                <signaturesFile>${project.parent.basedir}/src/build/forbidden/all.txt</signaturesFile>
                <signaturesFile>${project.parent.basedir}/src/build/forbidden/test.txt</signaturesFile>
              </signaturesFiles>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <dependencyManagement>
    <!-- Decalare the default parameters for some dependencies. -->
    <dependencies>
      <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>18.0</version>
      </dependency>
      <dependency>
        <groupId>org.wikidata.query.rdf</groupId>
        <artifactId>common</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.openrdf.sesame</groupId>
        <artifactId>sesame-query</artifactId>
        <version>${sesame.version}</version>
      </dependency>
      <dependency>
        <groupId>com.bigdata</groupId>
        <artifactId>bigdata</artifactId>
        <version>${blazegraph.version}</version>
      </dependency>
      <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-all</artifactId>
        <version>1.3</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>com.carrotsearch.randomizedtesting</groupId>
        <artifactId>randomizedtesting-runner</artifactId>
        <version>2.1.13</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-all</artifactId>
        <version>1.9.5</version>
        <scope>test</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
    </dependency>
    <dependency>
      <groupId>com.carrotsearch.randomizedtesting</groupId>
      <artifactId>randomizedtesting-runner</artifactId>
    </dependency>
  </dependencies>

  <!-- Blazegraph isn't released to Maven central. Yet. -->
  <repositories>
    <repository>
      <id>bigdata.releases</id>
      <url>http://www.systap.com/maven/releases</url>
    </repository>
    <repository>
      <id>wmf.mirrored</id>
      <url>http://archiva.wikimedia.org/repository/mirrored</url>
    </repository>
  </repositories>

  <profiles>
    <profile>
      <id>only-eclipse</id>
      <!-- Only do Eclipse lifecycle rules when in Eclipse. -->
      <activation>
        <property>
          <name>m2e.version</name>
        </property>
      </activation>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <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-enforcer-plugin</artifactId>
                        <versionRange>[1.0.0,)</versionRange>
                        <goals>
                          <goal>enforce</goal>
                        </goals>
                      </pluginExecutionFilter>
                      <action>
                        <ignore />
                      </action>
                    </pluginExecution>
                    <pluginExecution>
                      <pluginExecutionFilter>
                        <groupId>de.thetaphi</groupId>
                        <artifactId>forbiddenapis</artifactId>
                        <versionRange>[1.5,)</versionRange>
                        <goals>
                          <goal>testCheck</goal>
                          <goal>check</goal>
                        </goals>
                      </pluginExecutionFilter>
                      <action>
                        <ignore />
                      </action>
                    </pluginExecution>
                  </pluginExecutions>
                </lifecycleMappingMetadata>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
    <profile>
      <id>java-8</id>
      <activation>
        <jdk>[1.8,)</jdk>
      </activation>
      <properties>
        <javadoc.doclint.none>-Xdoclint:none</javadoc.doclint.none>
      </properties>
    </profile>
    <profile>
      <id>noVerify</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-checkstyle-plugin</artifactId>
            <version>2.13</version>
            <executions>
              <execution>
                <id>validate</id>
                <phase>none</phase>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>de.thetaphi</groupId>
            <artifactId>forbiddenapis</artifactId>
            <executions>
              <execution>
                <id>check-forbidden-apis</id>
                <phase>none</phase>
              </execution>
              <execution>
                <id>check-forbidden-test-apis</id>
                <phase>none</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <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>
    <profile>
     <id>deploy-archiva</id>
      <distributionManagement>
       <repository>
         <id>wikimedia.releases</id>
         <name>Wikimedia Release Repository</name>
         <url>https://archiva.wikimedia.org/repository/releases/</url>
       </repository>
       <snapshotRepository>
         <id>wikimedia.snapshots</id>
         <name>Wikimedia Snapshot Repository</name>
         <url>https://archiva.wikimedia.org/repository/snapshots/</url>
       </snapshotRepository>
      </distributionManagement>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.18.1</version>
            <configuration>
              <skipTests>true</skipTests>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
