<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>com.github.prasanthj</groupId>
    <artifactId>hyperloglog</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>
    <name>hyperloglog</name>
    <description>Implementation of HyperLogLog and HyperLogLog++ in Java</description>
    <url>https://github.com/prasanthj/hyperloglog</url>

    <!-- Required: license information: -->
    <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>

    <!-- Required: source control information: -->
    <scm>
        <url>https://github.com/prasanthj/hyperloglog</url>
        <connection>scm:git:git://github.com/prasanthj/hyperloglog.git</connection>
        <developerConnection>scm:git:git@github.com:prasanthj/hyperloglog.git</developerConnection>
        <tag>1.0</tag>
    </scm>

    <!-- Required: developer information: -->
    <developers>
        <developer>
            <id>prasanthj</id>
            <name>Prasanth Jayachandran</name>
            <email>prasanthj@apache.org</email>
            <url>https://github.com/prasanthj</url>
        </developer>
    </developers>

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

    <!-- More release information https://github.com/davidcarboni/releaser -->
    <profiles>
        <!-- Release to local nexus repository -->
        <!-- Start local nexus server -->
        <!-- /work/pkgs/nexus/current/bin/nexus console -->
        <!-- Navigate to http://localhost:8081/nexus/#view-repositories -->
        <profile>
            <id>local-release</id>
            <distributionManagement>
                <snapshotRepository>
                    <id>localhost-nexus-snapshots</id>
                    <name>Local Nexus snapshot repository</name>
                    <url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
                </snapshotRepository>
                <repository>
                    <id>localhost-nexus-staging</id>
                    <name>Local Nexus release repository</name>
                    <url>http://localhost:8081/nexus/content/repositories/releases/</url>
                </repository>
            </distributionManagement>
        </profile>

        <!-- Release to sonatype nexus repository -->
        <profile>
            <id>release</id>
            <distributionManagement>
               <snapshotRepository>
                   <id>sonatype-nexus-snapshots</id>
                   <name>Sonatype Nexus snapshot repository</name>
                   <url>https://oss.sonatype.org/content/repositories/snapshots</url>
               </snapshotRepository>
               <repository>
                   <id>sonatype-nexus-staging</id>
                   <name>Sonatype Nexus release repository</name>
                   <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
               </repository>
            </distributionManagement>
        </profile>

        <!-- GPG Signature on release -->
        <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.4</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <dependencies>
        <dependency>
            <groupId>it.unimi.dsi</groupId>
            <artifactId>fastutil</artifactId>
            <version>6.5.15</version>
        </dependency>
        <dependency>
            <groupId>commons-cli</groupId>
            <artifactId>commons-cli</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>11.0.2</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <directory>target</directory>
        <outputDirectory>target/classes</outputDirectory>
        <finalName>${project.artifactId}-${project.version}</finalName>
        <testOutputDirectory>target/test-classes</testOutputDirectory>
        <sourceDirectory>src/java</sourceDirectory>
        <testSourceDirectory>src/test</testSourceDirectory>

        <!-- Include the README, NOTICE and LICENSE files: -->
        <resources>
            <resource>
                <directory>${project.basedir}</directory>
                <includes>
                    <include>README*</include>
                    <include>NOTICE*</include>
                    <include>LICENSE*</include>
                </includes>
            </resource>
        </resources>

        <plugins>
            <!-- Copy dependicies to target/lib -->
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/lib</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- Tests plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.16</version>
                <configuration>
                    <reuseForks>false</reuseForks>
                    <environmentVariables>
                        <LANG>en_US.UTF-8</LANG>
                    </environmentVariables>
                    <failIfNoTests>false</failIfNoTests>
                </configuration>
            </plugin>

            <!-- Code coverage -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>2.7</version>
                <configuration>
                    <formats>
                        <format>html</format>
                        <format>xml</format>
                    </formats>
                    <check />
                </configuration>
            </plugin>

            <!-- Required: source JAR -->
            <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>

            <!-- Required: javadoc JAR -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.9.1</version>
                <executions>
                    <execution>
                        <id>attach-javadoc</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Release configuration: -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5</version>

                <configuration>
                    <!-- Automated passphrase entry: -->

                    <!-- To pass your passphrase to the build automatically, so avoiding 
                        manual interaction, you'll need to put the passphrase into settings.xml. 
                        You don't really want that to be in plain text, so you'll want to follow: 
                        http://maven.apache.org/guides/mini/guide-encryption.html -->
                    <!-- <arguments>-Dgpg.passphrase=${gpg.passphrase}</arguments> -->

                    <!-- Manual passphrase entry: -->

                    <!-- This is the simplest secure solution, but requires you to type 
                        your key passphrase in manually when performing a release. No biggie unless 
                        you want your CI server to decide when to release for you. -->
                    <mavenExecutorId>forked-path</mavenExecutorId>

                </configuration>
            </plugin>
            
            <!-- Deployment -->
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>1.6.4</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>sonatype-nexus-staging</serverId>
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
