<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.datadoghq</groupId>
    <artifactId>java-dogstatsd-client</artifactId>
    <packaging>jar</packaging>
    <name>java-dogstatsd-client</name>
    <version>4.0.0</version>
    <description>A tiny library allowing Java applications to communicate with DataDog statsd instances easily.</description>
    <url>https://github.com/DataDog/java-dogstatsd-client</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.scm.id>github</project.scm.id>
        <java.version>1.6</java.version>
        <!-- Note: using project checkstyle with AOSP style
        find the default google java checkstyle config here -
        <checkstyle.config.location>google_checks.xml</checkstyle.config.location>
        -->
        <checkstyle.config.location>style.xml</checkstyle.config.location>
        <checkstyle.consoleOutput>true</checkstyle.consoleOutput>
        <jdk.module.illegalAccess>deny</jdk.module.illegalAccess>
        <checkstyle.version>3.1.0</checkstyle.version>
    </properties>

    <licenses>
        <license>
            <name>The MIT License (MIT)</name>
            <url>http://opensource.org/licenses/MIT</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <url>https://github.com/DataDog/java-dogstatsd-client</url>
        <connection>scm:git:git@github.com:DataDog/java-dogstatsd-client.git</connection>
        <developerConnection>scm:git:git@github.com:Datadog/java-dogstatsd-client.git</developerConnection>
    </scm>

    <developers>
        <developer> <!-- Additions for new Datadog features -->
            <id>datadog</id>
            <name>Datadog developers</name>
            <email>dev@datadoghq.com</email>
        </developer>
        <developer> <!-- Initial datadog port -->
            <id>duffy</id>
            <name>Charles Duffy</name>
            <email>duffy@indeed.com</email>
        </developer>
        <developer> <!-- Upstream, pre-datadog version -->
            <id>scarytom</id>
            <name>Tom Denley</name>
            <email>tom.denley@timgroup.com</email>
        </developer>
    </developers>

    <profiles>
        <!-- Performing a release deployment requires setting of performRelease property -->
        <profile>
            <id>deploy-artifacts</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>

            <distributionManagement>
                <snapshotRepository>
                 <id>nexus</id>
                 <!-- Use the localhost endpoint for testing -->
                 <!-- <url>http://localhost:8081/repository/maven-snapshots/</url> -->
                 <url>https://oss.sonatype.org/content/repositories/snapshots</url>
                </snapshotRepository>
                <repository>
                    <id>nexus</id>
                    <!-- Use the localhost endpoint for testing -->
                    <!-- <url>http://localhost:8081/repository/maven-releases/</url> -->
                    <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
                </repository>
            </distributionManagement>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.6</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>nexus</serverId>
                            <!-- Use the localhost endpoint for testing -->
                            <!-- <nexusUrl>http://localhost:8081/repository/maven-releases/</nexusUrl> -->
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>false</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <gpgArguments>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Use -X option to see classpath -->
        <profile>
            <id>jnr-exclude</id>
            <!-- Compile main and test code with jnr-unixsocket in classpath, but drop it when
                 running tests. Make sure UDP and Windows support works even if jnr-unixsocket
                 dependency is not available.
            -->
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.19</version>
                        <configuration>
                            <classpathDependencyExcludes>
                                <classpathDependencyExclude>com.github.jnr:jnr-unixsocket</classpathDependencyExclude>
                            </classpathDependencyExcludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>jnr-latest</id>
            <!-- This profile is for testing for compatibility with the latest version of
                 jnr-unixsocket. Maven does not rebuild main or test code when profile changes,
                 so we can test how the code compiled with version X runs with version Y.
            -->
            <dependencies>
                 <dependency>
                    <groupId>com.github.jnr</groupId>
                    <artifactId>jnr-unixsocket</artifactId>
                    <version>0.38.15</version>
                </dependency>
            </dependencies>
        </profile>
    </profiles>

    <dependencies>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-core</artifactId>
            <scope>test</scope>
            <version>1.3</version>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-library</artifactId>
            <scope>test</scope>
            <version>1.3</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
            <version>4.13.1</version>
        </dependency>
        <dependency>
            <groupId>com.github.stefanbirkner</groupId>
            <artifactId>system-rules</artifactId>
            <scope>test</scope>
            <version>1.18.0</version>
        </dependency>
        <dependency>
            <groupId>net.java.dev.jna</groupId>
            <artifactId>jna-platform</artifactId>
            <scope>test</scope>
            <version>5.10.0</version>
        </dependency>
        <dependency>
            <groupId>com.github.jnr</groupId>
            <artifactId>jnr-unixsocket</artifactId>
            <version>0.36</version>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.19</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>3.0.0-M2</version>
                <executions>
                    <execution>
                        <id>validate</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireJavaVersion>
                                    <version>[1.7.0-0,1.9.0-0),[9.0.0,13.0.2]</version>
                                </requireJavaVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <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</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.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>3.1.0</version>
                <configuration>
                    <source>1.7</source>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${checkstyle.version}</version>
                <executions>
                    <execution>
                        <id>checkstyle</id>
                        <phase>verify</phase>
                        <configuration>
                            <encoding>UTF-8</encoding>
                            <consoleOutput>true</consoleOutput>
                            <failsOnError>true</failsOnError>
                            <failOnViolation>true</failOnViolation>
                            <violationSeverity>warning</violationSeverity>
                            <linkXRef>false</linkXRef>
                        </configuration>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                        <manifestEntries>
                            <Implementation-Branch>${scmBranch}</Implementation-Branch>
                            <Implementation-Build>${buildNumber}</Implementation-Build>
                        </manifestEntries>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- Skip the maven release default deploy, we use the Nexus staging plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${checkstyle.version}</version>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>checkstyle</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jxr-plugin</artifactId>
                <version>3.0.0</version>
            </plugin>
        </plugins>
    </reporting>
</project>
