<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.carrotsearch.randomizedtesting</groupId>
    <artifactId>randomizedtesting-parent</artifactId>
    <version>2.1.6</version>
    <relativePath>../../pom.xml</relativePath>
  </parent>

  <artifactId>randomizedtesting-examples-ant</artifactId>
  <name>RandomizedTesting ANT Examples</name>

  <description>
  Simple use-case examples meant to be included in some
  end-user documentation if it's ever going to be written...
  </description>

  <properties>
    <skip.deployment>true</skip.deployment>
  </properties>

  <dependencies>
    <!-- We'll pull in tests and their dependencies from the maven examples. -->
    <dependency>
      <groupId>com.carrotsearch.randomizedtesting</groupId>
      <artifactId>randomizedtesting-examples</artifactId>
      <version>${project.version}</version>
      <scope>compile</scope>
    </dependency>

    <!-- And we'll need junit4-ant locally, so add it as a dependency. -->
    <dependency>
      <groupId>com.carrotsearch.randomizedtesting</groupId>
      <artifactId>junit4-ant</artifactId>
      <version>${project.version}</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.eclipse.m2e</groupId>
          <artifactId>lifecycle-mapping</artifactId>
          <version>1.0.0</version>
          <configuration>
            <lifecycleMappingMetadata>
              <pluginExecutions>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <versionRange>[1.0.0,)</versionRange>
                    <goals>
                      <goal>copy-dependencies</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>

      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-dependencies</id>
            <phase>integration-test</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <configuration>
              <outputDirectory>${basedir}/target/lib</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>ant-run-tests</id>
            <phase>integration-test</phase>
            <configuration>
              <target unless="${skipTests}">
                <ant antfile="${basedir}/build.xml" inheritRefs="true" inheritAll="true" target="test" />
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  

  <profiles>
      <profile>
          <id>tools.jar</id>
          <activation>
              <file>
                <exists>${java.home}/../lib/tools.jar</exists>
              </file>
          </activation>
          <build>
            <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-antrun-plugin</artifactId>
              <dependencies>
                <dependency>
                  <groupId>com.sun</groupId>
                  <artifactId>tools</artifactId>
                  <version>1.5.0</version>
                  <scope>system</scope>
                  <systemPath>${java.home}/../lib/tools.jar</systemPath>
                </dependency>
              </dependencies>
            </plugin>
            </plugins>
          </build>
      </profile>  
    </profiles>
</project>
