<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
         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.intel.jndn.utils</groupId>
  <artifactId>jndn-utils</artifactId>
  <version>1.1.1</version>
  <name>jndn-utils</name>
  <description>Collection of tools to simplify synchronous and asynchronous data transfer over the NDN network
  </description>
  <url>https://github.com/01org/jndn-utils</url>
  <packaging>jar</packaging>

  <licenses>
    <license>
      <name>LGPL v3</name>
      <url>https://www.gnu.org/licenses/lgpl.html</url>
    </license>
  </licenses>

  <developers>
    <developer>
      <name>Andrew Brown</name>
      <url>http://github.com/andrewsbrown</url>
    </developer>
  </developers>

  <distributionManagement>
    <snapshotRepository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
  </distributionManagement>

  <scm>
    <url>https://github.com/01org/jndn-utils</url>
    <connection>scm:git:git@github.com:01org/jndn-utils.git</connection>
    <developerConnection>scm:git:git@github.com:01org/jndn-utils.git</developerConnection>
  </scm>

  <dependencies>
    <dependency>
      <groupId>net.named-data</groupId>
      <artifactId>jndn</artifactId>
      <version>0.13</version>
    </dependency>
    <!-- Test dependencies -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.10</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.intel.jndn.mock</groupId>
      <artifactId>jndn-mock</artifactId>
      <version>1.1.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <version>1.10.19</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>

  <profiles>
    <!-- Run `mvn clean package -P sonarqube` to send analyzed code to SonarQube -->
    <profile>
      <id>sonarqube</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.7.7.201606060606</version>
            <executions>
              <execution>
                <id>pre-unit-test</id>
                <goals>
                  <goal>prepare-agent</goal>
                </goals>
              </execution>
              <execution>
                <id>post-unit-test</id>
                <phase>test</phase>
                <goals>
                  <goal>report</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.sonarsource.scanner.maven</groupId>
            <artifactId>sonar-maven-plugin</artifactId>
            <version>3.0.2</version>
            <executions>
              <execution>
                <id>scan-with-sonar</id>
                <phase>prepare-package</phase>
                <goals>
                  <goal>sonar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- Use OSSRH-directed plugins (see http://central.sonatype.org/pages/apache-maven.html)
    for deployment to Maven central; e.g. `mvn deploy -P ossrh`-->
    <profile>
      <id>ossrh</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>2.4</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.10.2</version>
            <configuration>
              <additionalparam>-Xdoclint:none</additionalparam>
            </configuration>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>1.6.3</version>
            <extensions>true</extensions>
            <configuration>
              <serverId>ossrh</serverId>
              <stagingProfileId>a80137db01223a</stagingProfileId>
              <nexusUrl>https://oss.sonatype.org/</nexusUrl>
              <autoReleaseAfterClose>true</autoReleaseAfterClose>
            </configuration>
          </plugin>
          <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>

    <!-- Use failsafe to run integration tests with an NFD instance; e.g.
    `mvn verify -Pnfd-integration-tests -Dnfd.ip=10.0.0.1; these are not run by default
    due to the external NFD dependency -->
    <profile>
      <id>nfd-integration-tests</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>2.18.1</version>
            <executions>
              <execution>
                <id>runIntegrationTests</id>
                <phase>integration-test</phase>
                <goals>
                  <goal>integration-test</goal>
                </goals>
              </execution>
              <execution>
                <id>verifyIntegrationTests</id>
                <phase>verify</phase>
                <goals>
                  <goal>verify</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- Run `mvn clean javadoc:javadoc scm-publish:publish-scm -P docs` to push
    Javadoc to Github -->
    <profile>
      <id>docs</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.10.2</version>
            <configuration>
              <additionalparam>-Xdoclint:none</additionalparam>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-scm-publish-plugin</artifactId>
            <version>1.1</version>
            <configuration>
              <checkoutDirectory>${project.build.directory}/scmpublish</checkoutDirectory>
              <checkinComment>Publishing javadoc for ${project.artifactId}:${project.version}</checkinComment>
              <content>${project.build.directory}/site/apidocs</content>
              <skipDeletedFiles>true</skipDeletedFiles>
              <pubScmUrl>scm:git:https://github.com/01org/jndn-utils.git</pubScmUrl>
              <scmBranch>gh-pages</scmBranch>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
