<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>io.prometheus.jmx</groupId>
    <artifactId>parent</artifactId>
    <version>0.5</version>
  </parent>

  <groupId>io.prometheus.jmx</groupId>
  <artifactId>jmx_prometheus_httpserver</artifactId>
  <description>
    See https://github.com/prometheus/jmx_exporter/blob/master/README.md
  </description>
  <url>http://github.com/prometheus/jmx_exporter</url>

  <dependencies>
    <dependency>
      <groupId>io.prometheus.jmx</groupId>
      <artifactId>collector</artifactId>
      <version>0.5</version>
    </dependency>
    <dependency>
      <groupId>io.prometheus</groupId>
      <artifactId>simpleclient_servlet</artifactId>
      <version>0.0.8</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-servlet</artifactId>
      <version>8.1.7.v20120910</version>
    </dependency>
  </dependencies>


  <build>
    <plugins>
      <!-- Compile version (1.5 for generics) -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.3.2</version>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>

      <!-- Build a full jar with dependencies --> 
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <archive>
            <manifest>
              <mainClass>io.prometheus.jmx.WebServer</mainClass>
            </manifest>
          </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>

      <!-- debian package builder -->
      <plugin>
        <artifactId>jdeb</artifactId>
        <groupId>org.vafer</groupId>
        <version>1.0</version>

        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>jdeb</goal>
            </goals>
            <configuration>
              <dataSet>

                <data>
                  <src>${project.build.directory}/${project.build.finalName}-jar-with-dependencies.jar</src>
                  <type>file</type>
                  <mapper>
                    <type>perm</type>
                    <prefix>/usr/share/jmx_exporter</prefix>
                    <filemode>644</filemode>
                  </mapper>
                </data>

                <data>
                  <src>${basedir}/src/deb/config</src>
                  <type>directory</type>
                  <mapper>
                    <type>perm</type>
                    <prefix>/etc/jmx_exporter</prefix>
                  </mapper>
                </data>

                <data>
                  <src>${basedir}/src/deb/bin/jmx_exporter</src>
                  <type>file</type>
                  <mapper>
                    <type>perm</type>
                    <prefix>/usr/bin</prefix>
                    <filemode>755</filemode>
                  </mapper>
                </data>

              </dataSet>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  </properties>
</project>
