<?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>

  <groupId>net.lshift.diffa</groupId>
  <artifactId>snowflake</artifactId>
  <version>1.7.0</version>

  <name>LShift Diffa Snowflake</name>
  <description>Generator of globally unique 64-bit identifiers</description>

  <packaging>jar</packaging>

  <url>http://github.com/lshift/diffa</url>

  <properties>
    <buildVersion>${project.version}</buildVersion>    <!-- Can be overridden via -D -->
    <scalatest.version>1.8</scalatest.version>
    <curator.version>1.2.3</curator.version>
    <junit.version>4.10</junit.version>
    <zookeeper.version>3.4.5</zookeeper.version>
    <zookeeper.url.root>http://www.mirrorservice.org/sites/ftp.apache.org</zookeeper.url.root>
    <zookeeper.install.dir>/tmp/zookeeper-${zookeeper.version}</zookeeper.install.dir>
    <zookeeper.exec.bin>bin/zkServer.sh</zookeeper.exec.bin>
  </properties>

  <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>

  <scm>
    <url>https://github.com/lshift/diffa</url>
    <connection>scm:git:git@github.com:lshift/diffa.git</connection>
  </scm>

  <developers>
    <developer>
      <id>paulj</id>
      <name>Paul Jones</name>
    </developer>
    <developer>
      <id>0x6e6562</id>
      <name>Ben Hood</name>
    </developer>
  </developers>

  <dependencies>
    <dependency>
      <groupId>org.specs2</groupId>
      <artifactId>specs2_2.9.2</artifactId>
      <version>1.12.3</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.scalacheck</groupId>
      <artifactId>scalacheck_2.9.2</artifactId>
      <version>1.10.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.scalatest</groupId>
      <artifactId>scalatest_2.9.2</artifactId>
      <version>${scalatest.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.netflix.curator</groupId>
      <artifactId>curator-client</artifactId>
      <version>${curator.version}</version>
    </dependency>
    <dependency>
      <groupId>com.netflix.curator</groupId>
      <artifactId>curator-recipes</artifactId>
      <version>${curator.version}</version>
    </dependency>
    <dependency>
      <groupId>com.netflix.curator</groupId>
      <artifactId>curator-framework</artifactId>
      <version>${curator.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.zookeeper</groupId>
      <artifactId>zookeeper</artifactId>
      <version>3.4.5</version>
      <exclusions>
        <exclusion><groupId>com.sun.jdmk</groupId><artifactId>jmxtools</artifactId></exclusion>
        <exclusion><groupId>com.sun.jmx</groupId><artifactId>jmxri</artifactId></exclusion>
        <exclusion><groupId>javax.jms</groupId><artifactId>jms</artifactId></exclusion>
        <exclusion><groupId>org.slf4j</groupId><artifactId>slf4j-log4j12</artifactId></exclusion>
        <exclusion><groupId>log4j</groupId><artifactId>log4j</artifactId></exclusion>
      </exclusions>
    </dependency>
  </dependencies>

  <repositories>
    <repository>
      <id>sonatype</id>
      <name>releases</name>
      <url>http://oss.sonatype.org/content/groups/public</url>
    </repository>
  </repositories>

  <distributionManagement>
    <repository>
      <id>sonatype-nexus-staging</id>
      <name>Nexus OSS (Staging)</name>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
    </repository>
    <snapshotRepository>
      <id>sonatype-nexus-snapshots</id>
      <name>Nexus OSS (Snapshots)</name>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
  </distributionManagement>

  <build>
    <finalName>${project.artifactId}-${buildVersion}</finalName>
    <plugins>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.3.1</version>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.7</version>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>2.1.2</version>
      </plugin>

      <plugin>
        <groupId>org.scala-tools</groupId>
        <artifactId>maven-scala-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>com.googlecode.maven-download-plugin</groupId>
        <artifactId>maven-download-plugin</artifactId>
        <version>1.0.0</version>
        <dependencies>
          <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-archiver</artifactId>
            <version>1.2</version>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <id>install-zookeeper</id>
            <phase>pre-integration-test</phase>
            <goals><goal>wget</goal></goals>
            <configuration>
              <url>${zookeeper.url.root}/zookeeper/zookeeper-${zookeeper.version}/zookeeper-${zookeeper.version}.tar.gz</url>
              <unpack>true</unpack>
              <outputDirectory>/tmp</outputDirectory>
              <md5>f64fef86c0bf2e5e0484d19425b22dcb</md5>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-zookeeper-config</id>
            <goals><goal>copy-resources</goal></goals>
            <phase>pre-integration-test</phase>
            <configuration>
              <outputDirectory>${zookeeper.install.dir}/conf</outputDirectory>
              <resources>
                <resource>
                  <directory>src/test/resources</directory>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>start-zookeeper-server</id>
            <phase>pre-integration-test</phase>
            <goals><goal>exec</goal></goals>
            <configuration>
              <executable>${zookeeper.exec.bin}</executable>
              <commandlineArgs>start</commandlineArgs>
              <workingDirectory>${zookeeper.install.dir}</workingDirectory>
            </configuration>
          </execution>
          <execution>
            <id>stop-zookeeper-server</id>
            <phase>post-integration-test</phase>
            <goals><goal>exec</goal></goals>
            <configuration>
              <executable>${zookeeper.exec.bin}</executable>
              <commandlineArgs>stop</commandlineArgs>
              <workingDirectory>${zookeeper.install.dir}</workingDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <includes>
            <include>**/SnowflakeIdProviderSpec.class</include>
          </includes>
        </configuration>
        <executions>
          <execution>
            <id>surefire-itest</id>
            <phase>integration-test</phase>
            <goals>
              <goal>test</goal>
            </goals>
            <configuration>
              <includes>
                <include>**/itest/**/MachineIdAssignerSpec.class</include>
              </includes>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.scala-tools</groupId>
        <artifactId>maven-scala-plugin</artifactId>
      </plugin>
    </plugins>
  </reporting>

  <profiles>
    <profile>
      <id>release-sign-artifacts</id>
      <activation>
        <property>
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.1</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
