<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>junit4-ant</artifactId>
  <name><![CDATA[RandomizedTesting JUnit4 ANT Task]]></name>

  <dependencies>
    <dependency>
      <groupId>org.apache.ant</groupId>
      <artifactId>ant</artifactId>
      <scope>provided</scope>
    </dependency>
    
    <dependency>
      <groupId>org.apache.ant</groupId>
      <artifactId>ant-junit</artifactId>
      <scope>provided</scope>
    </dependency>

    <!-- Required at runtime -->

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <type>jar</type>
      <scope>provided</scope>
    </dependency>

    <!-- Embedded into standalone JAR. -->

    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <scope>provided</scope>
      <exclusions>
        <exclusion>
          <artifactId>jsr305</artifactId>
          <groupId>com.google.code.findbugs</groupId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.ow2.asm</groupId>
      <artifactId>asm</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.simpleframework</groupId>
      <artifactId>simple-xml</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>com.carrotsearch.randomizedtesting</groupId>
      <artifactId>randomizedtesting-runner</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>

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

          <configuration>
            <basedir>${project.build.directory}/test-classes</basedir>
            <!-- only include non-integration tests. -->
            <excludes>
              <exclude>**/tests/**</exclude>
              <exclude>**/it/**</exclude>
            </excludes>
          </configuration>

          <!-- Run in the integration tests phase only. -->
          <executions>
            <execution>
              <id>surefire-it</id>
              <phase>integration-test</phase>
              <goals>
                <goal>test</goal>
              </goals>
              <configuration>
                <includes>
                   <include>**/it/Test*.java</include>
                </includes>
                <excludes>
                  <exclude>**/tests/**</exclude>
                </excludes>
                <classesDirectory>${project.build.directory}/dontinclude</classesDirectory>
                <classpathDependencyExcludes>
                    <!--
                    Leave in for tests.
                    <classpathDependencyExcludes>asm:asm</classpathDependencyExcludes>
                    -->
                    <classpathDependencyExcludes>com.carrotsearch.randomizedtesting:randomizedtesting-runner</classpathDependencyExcludes>
                    <classpathDependencyExcludes>com.google.code.gson:gson</classpathDependencyExcludes>
                    <classpathDependencyExcludes>com.google.guava:guava</classpathDependencyExcludes>
                    <classpathDependencyExcludes>org.simpleframework:simple-xml</classpathDependencyExcludes>
                    <classpathDependencyExcludes>commons-io:commons-io</classpathDependencyExcludes>
                </classpathDependencyExcludes>
              </configuration>
            </execution>
          </executions>
        </plugin>

        <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>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <configuration>
            <overview>${basedir}/src/main/java/com/carrotsearch/ant/tasks/junit4/package.html</overview>
            <groups>
              <group>
                <title>JUnit4 ANT task</title>
                <packages>com.carrotsearch.ant.tasks.junit4*</packages>
              </group>
              <group>
                <title>Listeners and report writers</title>
                <packages>com.carrotsearch.ant.tasks.junit4.listeners*</packages>
              </group>
              <group>
                <title>Load balancers</title>
                <packages>com.carrotsearch.ant.tasks.junit4.balancers*</packages>
              </group>
              <group>
                <title>Events and aggregated events for reports</title>
                <packages>com.carrotsearch.ant.tasks.junit4.events*</packages>
              </group>
            </groups>
            <header><![CDATA[<div id='header'><a class='logo' target='_top' href='http://labs.carrotsearch.com'></a>${project.name} v${project.version} <br>API Documentation</div>]]></header>
            <excludePackageNames>com.carrotsearch.ant.tasks.junit4.slave</excludePackageNames>
          </configuration>
        </plugin>        
      </plugins>          
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-dependencies</id>
            <phase>package</phase>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <includeGroupIds>com.carrotsearch.randomizedtesting,junit,org.ow2.asm</includeGroupIds>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.2.1</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>java</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <mainClass>proguard.DetectRtJar</mainClass>
          <classpathScope>test</classpathScope>
          <arguments>
            <argument>${project.build.directory}/rt.jar.pro</argument>
          </arguments>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <forceCreation>true</forceCreation>
        </configuration>
      </plugin>

      <plugin>
        <groupId>com.pyx4me</groupId>
        <artifactId>proguard-maven-plugin</artifactId>
        <version>2.0.4</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>proguard</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <assembly>
            <inclusions>
              <inclusion>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <filter>!com/google/common/eventbus/SynchronizedEventHandler.class</filter>
              </inclusion>
              <inclusion>
                <groupId>org.ow2.asm</groupId>
                <artifactId>asm</artifactId>
              </inclusion>
              <inclusion>
                <groupId>commons-io</groupId>
                <artifactId>commons-io</artifactId>
              </inclusion>
              <inclusion>
                <groupId>org.simpleframework</groupId>
                <artifactId>simple-xml</artifactId>
              </inclusion>
              <inclusion>
                <groupId>com.google.code.gson</groupId>
                <artifactId>gson</artifactId>
              </inclusion>
              <inclusion>
                <groupId>com.carrotsearch.randomizedtesting</groupId>
                <artifactId>randomizedtesting-runner</artifactId>              
              </inclusion>
            </inclusions>
          </assembly>

          <addMavenDescriptor>true</addMavenDescriptor>
          <attach>true</attach>
          <appendClassifier>false</appendClassifier>
          <!-- <attachArtifactClassifier>standalone</attachArtifactClassifier> -->
          <obfuscate>true</obfuscate>
          <outputDirectory>${project.build.directory}</outputDirectory>
          <proguardInclude>${basedir}/src/proguard/rules.pro</proguardInclude>
          <options>
            <option>-include ${project.build.directory}/rt.jar.pro</option>
            <option>-printusage ${project.build.directory}/proguard_dead.txt</option>
          </options>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>net.sf.proguard</groupId>
            <artifactId>proguard</artifactId>
            <version>4.6-customized</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/lib/proguard.jar</systemPath>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>

    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <excludes>
              <exclude>**/*.jsonp</exclude>
              <exclude>**/ideas.txt</exclude>
            </excludes>
        </resource>
    </resources>
  </build>
</project>
