<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2012 - 2015 Metamarkets Group Inc.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

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

    <parent>
        <groupId>com.metamx</groupId>
        <artifactId>oss-parent</artifactId>
        <version>3</version>
    </parent>

    <artifactId>server-metrics</artifactId>
    <version>0.5.2</version>

    <name>${project.groupId}:${project.artifactId}</name>
    <description>Emit metrics here</description>
    <url>https://github.com/metamx/server-metrics</url>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Metamarkets Open Source Team</name>
            <email>oss@metamarkets.com</email>
            <organization>Metamarkets Group Inc.</organization>
            <organizationUrl>https://www.metamarkets.com</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:ssh://git@github.com/metamx/server-metrics.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/metamx/server-metrics.git</developerConnection>
        <url>https://github.com/metamx/server-metrics.git</url>
        <tag>server-metrics-0.5.2</tag>
    </scm>

    <properties>
        <sigar.base.version>1.6.5</sigar.base.version>
        <sigar.version>${sigar.base.version}.132</sigar.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.metamx</groupId>
            <artifactId>java-util</artifactId>
            <version>0.28.2</version>
        </dependency>
        <dependency>
            <groupId>com.metamx</groupId>
            <artifactId>emitter</artifactId>
            <version>0.4.5</version>
        </dependency>
        <dependency>
            <groupId>org.hyperic</groupId>
            <artifactId>sigar</artifactId>
            <version>${sigar.version}</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.hyperic</groupId>
            <artifactId>sigar-dist</artifactId>
            <version>${sigar.version}</version>
            <type>zip</type>
            <!-- "Provided" because this dependency is used only during the build itself: some files from this
            dependency are copied as resources. See maven-dependency-plugin configuration and <resources> below. -->
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.gridkit.lab</groupId>
            <artifactId>jvm-attach-api</artifactId>
            <version>1.2</version>
        </dependency>

        <!-- Tests -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.7.25</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.6.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-sigar-lib-to-resources</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <includeGroupIds>org.hyperic</includeGroupIds>
                            <includeArtifactIds>sigar-dist</includeArtifactIds>
                            <includes>**/sigar-bin/lib/*</includes>
                            <excludes>**/sigar-bin/lib/*jar</excludes>
                            <outputDirectory>
                                ${project.build.directory}
                            </outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.19.1</version>
                <configuration>
                    <systemProperties>
                        <property>
                            <name>java.library.path</name>
                            <value>${project.build.directory}/hyperic-sigar-${sigar.base.version}/sigar-bin/lib/</value>
                        </property>
                    </systemProperties>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
            </plugin>
        </plugins>

        <resources>
            <resource>
                <directory>
                    ${project.build.directory}/hyperic-sigar-${sigar.base.version}/sigar-bin/lib
                </directory>
            </resource>
        </resources>
    </build>

    <repositories>
        <repository>
            <id>sigar</id>
            <url>https://repository.jboss.org/nexus/content/repositories/thirdparty-uploads/</url>
        </repository>
    </repositories>
</project>
