<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>com.github.zk1931</groupId>
  <artifactId>jzab</artifactId>
  <packaging>jar</packaging>
  <version>0.3.0</version>
  <name>jzab</name>
  <description>An implementation of ZooKeeper Atomic Broadcast.</description>
  <url>https://github.com/zk1931/jzab</url>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.build.repo.directory>${project.build.directory}/repo</project.build.repo.directory>
  </properties>
  <developers>
    <developer>
      <name>Yisheng Liao</name>
      <email>eason.liao@nyu.edu</email>
      <organization>zk1931</organization>
      <organizationUrl>https://github.com/zk1931</organizationUrl>
    </developer>
    <developer>
      <name>Michi Mutsuzaki</name>
      <email>michi@cs.stanford.edu</email>
      <organization>zk1931</organization>
      <organizationUrl>https://github.com/zk1931</organizationUrl>
    </developer>
    <developer>
      <name>Flavio Junqueira</name>
      <email>fpj@apache.org</email>
      <organization>zk1931</organization>
      <organizationUrl>https://github.com/zk1931</organizationUrl>
    </developer>
    <developer>
      <name>Hongchao Deng</name>
      <email>hdeng@cloudera.com</email>
      <organization>zk1931</organization>
      <organizationUrl>https://github.com/zk1931</organizationUrl>
    </developer>
  </developers>
  <licenses>
    <license>
      <name>The Apache License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>
  <scm>
    <connection>scm:git:git@github.com:zk1931/jzab.git</connection>
    <developerConnection>scm:git:git@github.com:zk1931/jzab.git</developerConnection>
    <url>https://github.com/zk1931/jzab</url>
  </scm>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.9.1</version>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <phase>verify</phase>
            <goals>
              <goal>aggregate</goal>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>2.12.1</version>
        <configuration>
          <configLocation>checkstyle.xml</configLocation>
          <suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
          <suppressionsFileExpression>checkstyle.suppressions.file</suppressionsFileExpression>
          <encoding>UTF-8</encoding>
          <consoleOutput>true</consoleOutput>
          <failsOnError>true</failsOnError>
          <linkXRef>false</linkXRef>
          <includeTestSourceDirectory>true</includeTestSourceDirectory>
        </configuration>
        <executions>
          <execution>
            <id>validate</id>
            <phase>validate</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- Publish Maven artifacts to https://github.com/ZK-1931/mvnrepo -->
      <plugin>
        <artifactId>maven-deploy-plugin</artifactId>
        <version>2.7</version>
        <configuration>
          <altDeploymentRepository>internal.repo::default::file://${project.build.repo.directory}</altDeploymentRepository>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.17</version>
        <configuration>
          <argLine>-Xmx2g</argLine>
          <redirectTestOutputToFile>true</redirectTestOutputToFile>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>findbugs-maven-plugin</artifactId>
        <version>2.5.4</version>
        <configuration>
          <excludeFilterFile>findbugs-exclude.xml</excludeFilterFile>
          <effort>Max</effort>
          <threshold>Low</threshold>
          <xmlOutput>false</xmlOutput>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>2.2.1</version>
        <executions>
          <execution>
            <id>attach-sources</id>
            <phase>verify</phase>
            <goals>
              <goal>jar-no-fork</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- Delete target/data before running unit tests -->
      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <version>2.5</version>
        <executions>
          <execution>
            <id>auto-clean</id>
            <phase>initialize</phase>
            <goals>
              <goal>clean</goal>
            </goals>
            <configuration>
             <excludeDefaultDirectories>true</excludeDefaultDirectories>
             <filesets>
                <fileset>
                  <directory>target/data</directory>
                </fileset>
                <fileset>
                  <directory>target/generated-resources</directory>
                </fileset>
              </filesets>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>generate-sources</id>
            <phase>generate-sources</phase>
            <configuration>
              <tasks>
                <mkdir dir="target/generated-sources" />
                <exec executable="protoc">
                  <arg value="--java_out=target/generated-sources" />
                  <arg value="src/main/resources/zab_message.proto" />
                </exec>
              </tasks>
              <sourceRoot>target/generated-sources</sourceRoot>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
          <!-- Generate keystore/truststore for netty ssl test -->
          <execution>
            <id>generate-test-resources</id>
            <phase>generate-test-resources</phase>
            <configuration>
              <tasks>
                <mkdir dir="target/generated-resources/ssl" />
                <exec executable="src/test/resources/generate-test-certificates">
                  <arg value="target/generated-resources/ssl" />
                </exec>
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>2.2</version>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <!-- We use separate profile for releasing to pass travis build. -->
    <profile>
      <id>ossrh</id>
      <distributionManagement>
        <snapshotRepository>
          <id>ossrh</id>
          <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
      </distributionManagement>
      <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>
          <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>
        </plugins>
      </build>
    </profile>
  </profiles>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>1.7.5</version>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <version>1.1.2</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.google.protobuf</groupId>
      <artifactId>protobuf-java</artifactId>
      <version>2.4.1</version>
    </dependency>
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-all</artifactId>
      <version>4.0.21.Final</version>
    </dependency>
  </dependencies>
</project>

