<?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/maven-v4_0_0.xsd">
  <parent>
    <artifactId>hawkular-apm</artifactId>
    <groupId>org.hawkular.apm</groupId>
    <version>0.14.2.Final</version>
    <relativePath>../../pom.xml</relativePath>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <artifactId>hawkular-apm-agent</artifactId>
  <name>Hawkular APM::Client::Agent</name>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <id>all-assembly</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <descriptors>
            <descriptor>src/main/scripts/all-assembly.xml</descriptor>
          </descriptors>
          <appendAssemblyId>false</appendAssemblyId>
          <archive>
            <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
          </archive>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-shade-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <relocations>
                <relocation>
                  <pattern>org.hawkular.apm.api</pattern>
                  <shadedPattern>shaded.org.hawkular.apm.api</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>org.hawkular.apm.server</pattern>
                  <shadedPattern>shaded.org.hawkular.apm.server</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>org.hawkular.apm.client.api</pattern>
                  <shadedPattern>shaded.org.hawkular.apm.client.api</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>org.hawkular.apm.client.kafka</pattern>
                  <shadedPattern>shaded.org.hawkular.apm.client.kafka</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>com.fasterxml</pattern>
                  <shadedPattern>shaded.com.fasterxml</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>com.jayway</pattern>
                  <shadedPattern>shaded.com.jayway</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>net.minidev</pattern>
                  <shadedPattern>shaded.net.minidev</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>org.mvel2</pattern>
                  <shadedPattern>shaded.org.mvel2</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>org.objectweb</pattern>
                  <shadedPattern>shaded.org.objectweb</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>org.slf4j</pattern>
                  <shadedPattern>shaded.org.slf4j</shadedPattern>
                </relocation>
              </relocations>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <skip>true</skip>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>get-client-all</id>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>copy</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.hawkular.apm</groupId>
                  <artifactId>hawkular-apm-agent</artifactId>
                  <overWrite>true</overWrite>
                  <outputDirectory>${hawkular-apm.lib}</outputDirectory>
                  <destFileName>hawkular-apm-agent.jar</destFileName>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
          <execution>
            <id>unpack</id>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.hawkular.apm</groupId>
                  <artifactId>hawkular-apm-instrumentation-jvm</artifactId>
                </artifactItem>
              </artifactItems>
              <outputDirectory>${hawkular-apm.instrumentation}</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-failsafe-plugin</artifactId>
        <executions>
          <execution>
            <id>exec-standalone-tests</id>
            <goals>
              <goal>integration-test</goal>
            </goals>
            <configuration>
              <includes>
                <include>**/*Test.java</include>
              </includes>
            </configuration>
          </execution>
          <execution>
            <id>final-verify</id>
            <goals>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <threadCount>1</threadCount>
          <threadCountClasses>1</threadCountClasses>
          <argLine>-javaagent:${hawkular-apm.lib}/hawkular-apm-agent.jar
              -DHAWKULAR_APM_CONFIG=${hawkular-apm.instrumentation}/apmconfig
              -DHAWKULAR_APM_URI=http://localhost:8080
              -DHAWKULAR_APM_USERNAME=jdoe
              -DHAWKULAR_APM_PASSWORD=password</argLine>
          <classpathDependencyScopeExclude>runtime</classpathDependencyScopeExclude>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <artifactId>hamcrest-core</artifactId>
          <groupId>org.hamcrest</groupId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>
  <properties>
    <hawkular-apm.lib>${project.build.directory}/lib</hawkular-apm.lib>
    <hawkular-apm.instrumentation>${project.basedir}/target/test-classes/instrumentation</hawkular-apm.instrumentation>
  </properties>
</project>

