<?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>se.hiq.oss</groupId>
        <artifactId>oss-parent-pom</artifactId>
        <version>0.3</version>
  	</parent>
    <groupId>se.hiq.oss.qa</groupId>
    <artifactId>qa-parent-pom</artifactId>
    <version>0.1</version>
    <packaging>pom</packaging>

    <name>QA-Parent</name>
    <description>The Quality Assurance parent pom for OSS Java Projects</description>
    <url>https://bitbucket.org/hiq-oss/qa-parent-pom.git</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <qa-rules.version>0.1</qa-rules.version>

    </properties>

    <scm>
        <url>https://bitbucket.org/hiq-oss/qa-parent-pom.git</url>
  		<connection>scm:git:https://bitbucket.org/hiq-oss/qa-parent-pom.git</connection>
		<developerConnection>scm:git:https://bitbucket.org/hiq-oss/qa-parent-pom.git</developerConnection>
        <tag>qa-parent-pom-0.1</tag>
    </scm>


    <dependencies>
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>annotations</artifactId>
            <version>3.0.1u2</version>
        </dependency>
        <dependency>
            <groupId>se.hiq.oss.qa</groupId>
            <artifactId>qa-rules</artifactId>
            <version>${qa-rules.version}</version>
        </dependency>
    </dependencies>

  <reporting>
      <plugins>
          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-project-info-reports-plugin</artifactId>
              <version>2.6</version>
          </plugin>
          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-site-plugin</artifactId>
              <version>3.6</version>
          </plugin>
      </plugins>
  </reporting>

  <build>
      <plugins>
          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-failsafe-plugin</artifactId>
              <version>2.20</version>
              <executions>
                  <execution>
                      <goals>
                          <goal>integration-test</goal>
                          <goal>verify</goal>
                      </goals>
                  </execution>
              </executions>
          </plugin>
      </plugins>
  </build>


  <profiles>


      <profile>
          <id>checkstyle</id>
          <activation>
              <property>
                  <name>run.qa</name>
                  <value>true</value>
              </property>
          </activation>

          <properties>
              <checkstyle.maven.version>2.17</checkstyle.maven.version>
              <checkstyle.failOnViolation>true</checkstyle.failOnViolation>
              <checkstyle.skip>false</checkstyle.skip>
              <checkstyle.maxAllowedViolations>0</checkstyle.maxAllowedViolations>
              <checkstyle.configLocation>${project.build.directory}/build/checkstyle/checkstyle.xml</checkstyle.configLocation>
              <checkstyle.suppressionsLocation>${project.build.directory}/build/checkstyle/checkstyle-suppressions.xml</checkstyle.suppressionsLocation>
              <checkstyle.suppressionsFileExpression>checkstyle.suppressions.file</checkstyle.suppressionsFileExpression>

          </properties>

          <reporting>
              <plugins>
                  <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-checkstyle-plugin</artifactId>
                      <version>${checkstyle.maven.version}</version>
                      <reportSets>
                          <reportSet>
                              <reports>
                                  <report>checkstyle</report>
                              </reports>
                          </reportSet>
                      </reportSets>
                      <configuration>
                          <configLocation>${checkstyle.configLocation}</configLocation>
                          <suppressionsLocation>${checkstyle.suppressionsLocation}</suppressionsLocation>
                          <suppressionsFileExpression>${checkstyle.suppressionsFileExpression}</suppressionsFileExpression>
                      </configuration>
                  </plugin>
              </plugins>
          </reporting>

          <build>
              <pluginManagement>
                  <plugins>
                      <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-checkstyle-plugin</artifactId>
                          <version>${checkstyle.maven.version}</version>
                          <configuration>
                              <configLocation>${checkstyle.configLocation}</configLocation>
                              <suppressionsLocation>${checkstyle.suppressionsLocation}</suppressionsLocation>
                              <suppressionsFileExpression>${checkstyle.suppressionsFileExpression}</suppressionsFileExpression>
                          </configuration>
                      </plugin>
                  </plugins>
              </pluginManagement>
              <plugins>
                  <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-checkstyle-plugin</artifactId>
                      <executions>
                          <execution>
                              <goals>
                                  <goal>check</goal>
                              </goals>
                          </execution>
                      </executions>
                  </plugin>
                  <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-dependency-plugin</artifactId>
                      <executions>
                          <execution>
                              <id>unpack-checkstyle-rules</id>
                              <phase>process-resources</phase>
                              <goals>
                                  <goal>unpack</goal>
                              </goals>
                              <configuration>
                                  <artifactItems>
                                      <artifactItem>
                                          <groupId>se.hiq.oss.qa</groupId>
                                          <artifactId>qa-rules</artifactId>
                                          <version>${qa-rules.version}</version>
                                          <outputDirectory>${project.build.directory}/build</outputDirectory>
                                          <includes>checkstyle/**</includes>
                                      </artifactItem>
                                  </artifactItems>
                              </configuration>
                          </execution>
                      </executions>
                  </plugin>
              </plugins>
          </build>
      </profile>

      <!-- Cobertura Profile -->
      <profile>
          <id>cobertura</id>
          <activation>
              <property>
                  <name>run.qa</name>
                  <value>true</value>
              </property>
          </activation>
          <properties>
              <cobertura.maven.version>2.7</cobertura.maven.version>
              <cobertura.skip>false</cobertura.skip>
              <cobertura.haltOnFailure>true</cobertura.haltOnFailure>
              <cobertura.totalBranchRate>80</cobertura.totalBranchRate>
              <cobertura.totalLineRate>80</cobertura.totalLineRate>
          </properties>


          <reporting>
              <plugins>
                  <plugin>
                      <groupId>org.codehaus.mojo</groupId>
                      <artifactId>cobertura-maven-plugin</artifactId>
                      <version>${cobertura.maven.version}</version>
                  </plugin>
              </plugins>
          </reporting>

          <build>
              <pluginManagement>
                  <plugins>
                      <plugin>
                          <groupId>org.codehaus.mojo</groupId>
                          <artifactId>cobertura-maven-plugin</artifactId>
                          <version>${cobertura.maven.version}</version>
                          <configuration>
                              <check>
                                  <haltOnFailure>${cobertura.haltOnFailure}</haltOnFailure>
                                  <totalBranchRate>${cobertura.totalBranchRate}</totalBranchRate>
                                  <totalLineRate>${cobertura.totalLineRate}</totalLineRate>
                              </check>
                              <instrumentation>
                                  <ignoreTrivial>true</ignoreTrivial>
                                  <ignoreMethodAnnotations>
                                      <ignoreMethodAnnotation>se.hiq.oss.qa.annotation.CoverageIgnore</ignoreMethodAnnotation>
                                      <ignoreMethodAnnotation>se.hiq.oss.qa.annotation.Generated</ignoreMethodAnnotation>
                                      <ignoreMethodAnnotation>org.springframework.context.annotation.Bean</ignoreMethodAnnotation>
                                  </ignoreMethodAnnotations>
                              </instrumentation>
                          </configuration>
                      </plugin>
                  </plugins>
              </pluginManagement>
              <plugins>
                  <plugin>
                      <groupId>org.codehaus.mojo</groupId>
                      <artifactId>cobertura-maven-plugin</artifactId>
                      <executions>
                          <execution>
                              <goals>
                                  <goal>clean</goal>
                                  <goal>check</goal>
                              </goals>
                          </execution>
                      </executions>
                  </plugin>
              </plugins>
          </build>
      </profile>

      <!-- PMD Profile -->
      <profile>
          <id>pmd</id>
          <activation>
              <property>
                  <name>run.qa</name>
                  <value>true</value>
              </property>
          </activation>
          <properties>
              <pmd.maven.version>3.8</pmd.maven.version>
              <pmd.failOnViolation>true</pmd.failOnViolation>
              <pmd.failurePriority>5</pmd.failurePriority>
              <pmd.skip>false</pmd.skip>
              <pmd.printFailingErrors>true</pmd.printFailingErrors>
              <pmd.verbose>true</pmd.verbose>
          </properties>

          <reporting>
              <plugins>
                  <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-pmd-plugin</artifactId>
                      <version>${pmd.maven.version}</version>
                      <configuration>
                          <rulesets>
                              <ruleset>${project.build.directory}/build/pmd/pmd.xml</ruleset>
                          </rulesets>
                      </configuration>
                  </plugin>
                  <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-jxr-plugin</artifactId>
                      <version>2.5</version>
                  </plugin>
              </plugins>
          </reporting>

          <build>
              <pluginManagement>
                  <plugins>
                      <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-pmd-plugin</artifactId>
                          <version>${pmd.maven.version}</version>
                          <configuration>
                              <rulesets>
                                  <ruleset>${project.build.directory}/build/pmd/pmd.xml</ruleset>
                              </rulesets>
                          </configuration>
                      </plugin>
                  </plugins>
              </pluginManagement>
              <plugins>
                  <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-pmd-plugin</artifactId>
                      <executions>
                          <execution>
                              <goals>
                                  <goal>check</goal>
                                  <goal>cpd-check</goal>
                              </goals>
                          </execution>
                      </executions>
                  </plugin>
                  <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-dependency-plugin</artifactId>
                      <executions>
                          <execution>
                              <id>unpack-pmd-rules</id>
                              <phase>process-resources</phase>
                              <goals>
                                  <goal>unpack</goal>
                              </goals>
                              <configuration>
                                  <artifactItems>
                                      <artifactItem>
                                          <groupId>se.hiq.oss.qa</groupId>
                                          <artifactId>qa-rules</artifactId>
                                          <version>${qa-rules.version}</version>
                                          <outputDirectory>${project.build.directory}/build</outputDirectory>
                                          <includes>pmd/**</includes>
                                      </artifactItem>
                                  </artifactItems>
                              </configuration>
                          </execution>
                      </executions>
                  </plugin>
              </plugins>
          </build>
      </profile>

      <profile>
          <id>findbugs</id>
          <activation>
              <property>
                  <name>run.qa</name>
                  <value>true</value>
              </property>
          </activation>
          <properties>
              <findbugs.maven.version>3.0.4</findbugs.maven.version>
              <findbugs.failOnError>true</findbugs.failOnError>
              <findbugs.skip>false</findbugs.skip>
              <findbugs.effort>Max</findbugs.effort>
              <findbugs.threshold>Low</findbugs.threshold>
          </properties>


          <reporting>
              <plugins>
                  <plugin>
                      <groupId>org.codehaus.mojo</groupId>
                      <artifactId>findbugs-maven-plugin</artifactId>
                      <version>${findbugs.maven.version}</version>
                      <configuration>
                          <xmlOutput>true</xmlOutput>
                          <xmlOutputDirectory>target/site</xmlOutputDirectory>
                      </configuration>
                  </plugin>
              </plugins>
          </reporting>

          <build>
              <pluginManagement>
                  <plugins>
                      <plugin>
                          <groupId>org.codehaus.mojo</groupId>
                          <artifactId>findbugs-maven-plugin</artifactId>
                          <version>${findbugs.maven.version}</version>
                      </plugin>
                  </plugins>
              </pluginManagement>
              <plugins>
                  <plugin>
                      <groupId>org.codehaus.mojo</groupId>
                      <artifactId>findbugs-maven-plugin</artifactId>
                      <executions>
                          <execution>
                              <goals>
                                  <goal>check</goal>
                              </goals>
                          </execution>
                      </executions>
                  </plugin>
              </plugins>
          </build>
      </profile>

      <profile>
          <id>enforcer</id>
          <activation>
              <property>
                  <name>run.qa</name>
                  <value>true</value>
              </property>
          </activation>
          <properties>
              <enforcer.skip>false</enforcer.skip>
              <enforcer.fail>true</enforcer.fail>
              <enforcer.failFast>false</enforcer.failFast>
              <enforcer.requireMavenVersion>3.3.0</enforcer.requireMavenVersion>
              <enforcer.requireJavaVersion>1.8</enforcer.requireJavaVersion>
          </properties>
          <build>
              <pluginManagement>
                  <plugins>
                      <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-enforcer-plugin</artifactId>
                          <version>1.4.1</version>
                      </plugin>
                  </plugins>
              </pluginManagement>
              <plugins>
                  <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-enforcer-plugin</artifactId>
                      <executions>
                          <execution>
                              <id>enforce-versions</id>
                              <goals>
                                  <goal>enforce</goal>
                              </goals>
                              <configuration>
                                  <rules>
                                      <requireMavenVersion>
                                          <version>${enforcer.requireMavenVersion}</version>
                                      </requireMavenVersion>
                                      <requireJavaVersion>
                                          <version>${enforcer.requireJavaVersion}</version>
                                      </requireJavaVersion>
                                  </rules>
                              </configuration>
                          </execution>
                          <execution>
                              <id>enforce-banned-deps</id>
                              <goals>
                                  <goal>enforce</goal>
                              </goals>
                              <configuration>
                                  <rules>
                                      <bannedDependencies>
                                          <excludes>
                                              <exclude>log4j:log4j</exclude>
                                              <exclude>commons-logging:commons-logging</exclude>
                                          </excludes>
                                      </bannedDependencies>
                                  </rules>
                              </configuration>
                          </execution>
                      </executions>
                  </plugin>
              </plugins>
          </build>
      </profile>

      <profile>
          <id>javadoc</id>
          <activation>
              <property>
                  <name>run.qa</name>
                  <value>true</value>
              </property>
          </activation>
          <properties>
            <maven.javadoc.failOnError>true</maven.javadoc.failOnError>
          </properties>
          <reporting>
              <plugins>
                  <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-javadoc-plugin</artifactId>
                      <version>2.10.4</version>
                      <configuration>
                          <links>
                              <link>https://docs.oracle.com/javase/8/docs/api/</link>
                              <link>https://docs.spring.io/spring/docs/current/javadoc-api/</link>
                              <link>https://ci.apache.org/projects/flink/flink-docs-master/api/java/</link>
                              <link>https://kafka.apache.org/0100/javadoc/</link>
                          </links>
                          <detectLinks>true</detectLinks>
                      </configuration>
                  </plugin>
              </plugins>
          </reporting>
          <build>
              <pluginManagement>
                  <plugins>
                      <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-javadoc-plugin</artifactId>
                          <version>2.10.4</version>
                          <configuration>
                              <quiet>true</quiet>
                          </configuration>
                      </plugin>
                  </plugins>
              </pluginManagement>
              <plugins>
                  <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-javadoc-plugin</artifactId>
                      <executions>
                          <execution>
                              <goals>
                                  <goal>javadoc</goal>
                              </goals>
                              <phase>verify</phase>
                          </execution>
                      </executions>
                  </plugin>
              </plugins>
          </build>
      </profile>


  </profiles>
</project>
