<?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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <artifactId>opentracing-agent-rules-parent</artifactId>
        <groupId>io.opentracing.contrib</groupId>
        <version>0.4.0</version>
    </parent>

    <artifactId>opentracing-agent-rules-java-jdbc</artifactId>

    <properties>
        <opentracing-agent.lib>${project.build.directory}/lib</opentracing-agent.lib>
    </properties>

    <dependencies>
        <dependency>
            <groupId>io.opentracing.contrib</groupId>
            <artifactId>opentracing-agent</artifactId>
            <scope>test</scope>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>io.opentracing.contrib</groupId>
            <artifactId>opentracing-agent-itests</artifactId>
            <scope>test</scope>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>io.opentracing</groupId>
            <artifactId>opentracing-mock</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.opentracing.contrib</groupId>
            <artifactId>opentracing-jdbc</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${version.junit}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>get-agent</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>io.opentracing.contrib</groupId>
                                    <artifactId>opentracing-agent</artifactId>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${opentracing-agent.lib}</outputDirectory>
                                    <destFileName>opentracing-agent.jar</destFileName>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <configuration>
                    <argLine>
                        -javaagent:${opentracing-agent.lib}/opentracing-agent.jar
                        -Dorg.jboss.byteman.verbose
                    </argLine>
                </configuration>
                <executions>
                    <execution>
                        <id>run-integration-tests</id>
                        <goals>
                            <goal>integration-test</goal>
                        </goals>
                        <configuration>
                            <includes>
                                <include>**/*ITest.java</include>
                            </includes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>final-verify</id>
                        <goals>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>
