<?xml version="1.0"?>
<project>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>3.0.2</version>
        <executions>
          <execution>
            <id>package-test-jar</id>
            <phase>package</phase>
            <goals>
              <goal>test-jar</goal>
            </goals>
            <configuration>
              <archive>
                <addMavenDescriptor>false</addMavenDescriptor>
              </archive>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>3.0.1</version>
        <executions>
          <execution>
            <id>attach-sources</id>
            <phase>verify</phase>
            <goals>
              <goal>test-jar-no-fork</goal>
            </goals>
            <configuration>
              <archive>
                <addMavenDescriptor>false</addMavenDescriptor>
              </archive>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.22.0</version>
        <configuration>
          <encoding>UTF-8</encoding>
          <failIfNoTests>false</failIfNoTests>
          <includes>
            <include>**/*Test.java</include>
          </includes>
          <excludes>
            <exclude>**/*$*</exclude>
            <exclude>**/*SanityTest.java</exclude>
            <exclude>**/*IntegrationTest.java</exclude>
            <exclude>**/*ComponentTest.java</exclude>
            <exclude>**/*FunctionalTest.java</exclude>
            <exclude>**/*ManualTest.java</exclude>
          </excludes>
          <useSystemClassLoader>false</useSystemClassLoader>
          <systemPropertyVariables>
            <buildDirectory>${project.build.directory}</buildDirectory>
          </systemPropertyVariables>
        </configuration>
        <executions>
          <execution>
            <id>run-component-tests</id>
            <phase>test</phase>
            <goals>
              <goal>test</goal>
            </goals>
            <configuration>
              <includes>
                <include>**/*ComponentTest.java</include>
                <include>**/*SanityTest.java</include>
              </includes>
              <excludes>
                <exclude>**/*$*</exclude><!-- Exclude inner classes -->
              </excludes>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>2.22.0</version>
        <configuration>
          <encoding>UTF-8</encoding>
          <failIfNoTests>false</failIfNoTests>
          <includes>
            <include>**/*FunctionalTest.java</include>
            <include>**/*IntegrationTest.java</include>
          </includes>
          <excludes>
            <exclude>**/*$*</exclude><!-- Exclude inner classes -->
          </excludes>
          <useSystemClassLoader>false</useSystemClassLoader>
          <systemPropertyVariables>
            <buildDirectory>${project.build.directory}</buildDirectory>
          </systemPropertyVariables>
        </configuration>

        <executions>
          <execution>
            <id>run-integration-tests</id>
            <goals>
              <goal>integration-test</goal>
            </goals>
          </execution>

          <execution>
            <id>verify-integration-tests</id>
            <goals>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
