<?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>
        <groupId>com.linkedin.agentloader</groupId>
        <artifactId>linkedin-agent-loader-parent</artifactId>
        <version>1.0.4</version>
        <relativePath>..</relativePath>
    </parent>
    <artifactId>linkedin-agent-loader</artifactId>
    <name>Linkedin Agent Loader</name>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>

                <executions>
                    <!-- without forking = child class loader will be used -->
                    <execution>
                        <id>test-fork-never</id>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <phase>test</phase>
                        <configuration>
                            <forkMode>never</forkMode>
                        </configuration>
                    </execution>

                    <!-- a special failure case -->
                    <execution>
                        <id>test-failure</id>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <phase>test</phase>
                        <configuration>
                            <useSystemClassLoader>false</useSystemClassLoader>
                            <includes>
                                <include>**/AgentFailure.java</include>
                            </includes>
                            <forkMode>never</forkMode>
                        </configuration>
                    </execution>

                    <!-- forking -->
                    <execution>
                        <id>test-fork-always</id>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <phase>test</phase>
                        <configuration>
                            <forkMode>always</forkMode>
                            <useManifestOnlyJar>false</useManifestOnlyJar>
                            <forkMode>always</forkMode>
                        </configuration>
                    </execution>
                    <!-- without the sun tools jar-->
                    <execution>
                        <id>test-no-sun-tools</id>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <phase>test</phase>
                        <configuration>
                            <useManifestOnlyJar>false</useManifestOnlyJar>
                            <classpathDependencyExcludes>
                                <classpathDependencyExclude>com.sun:tools</classpathDependencyExclude>
                            </classpathDependencyExcludes>
                            <forkMode>always</forkMode>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <properties>
        <toolsjar>${java.home}/../lib/tools.jar</toolsjar>
    </properties>

    <profiles>
        <profile>
            <id>mac-profile</id>
            <activation>
                <file>
                    <exists>${java.home}/../Classes/classes.jar</exists>
                </file>
            </activation>
            <properties>
                <toolsjar>${java.home}/../Classes/classes.jar</toolsjar>
            </properties>
        </profile>
    </profiles>

    <dependencies>
        <dependency>
            <groupId>com.sun</groupId>
            <artifactId>tools</artifactId>
            <version>1.8.0</version>
            <scope>system</scope>
            <optional>true</optional>
            <systemPath>${toolsjar}</systemPath>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>


</project>
