<?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>org.kasource</groupId>
        <artifactId>java-base-pom</artifactId>
        <version>0.3</version>
    </parent>

    <artifactId>java-qa-pom</artifactId>
    <version>0.5</version>
    <packaging>pom</packaging>

    <name>QA-Parent-Java</name>
    <description>The Quality Assurance parent pom for Java Projects</description>

    <properties>
        <qa-rules.version>0.4</qa-rules.version>
    </properties>

    <scm>
        <connection>${scm.connection.url}</connection>
        <developerConnection>${scm.connection.url}</developerConnection>
        <url>${scm.url}</url>
        <tag>java-qa-pom-0.5</tag>
    </scm>


    <dependencies>
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>annotations</artifactId>
            <version>3.0.1u2</version>
        </dependency>
        <dependency>
            <groupId>org.kasource</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>3.0.0</version>
          </plugin>
          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-site-plugin</artifactId>
              <version>3.8.2</version>
          </plugin>
      </plugins>
  </reporting>

  <build>
      <pluginManagement>
          <plugins>
              <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-surefire-plugin</artifactId>
                  <version>2.22.2</version>
              </plugin>
              <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-failsafe-plugin</artifactId>
                  <version>2.22.2</version>
              </plugin>
          </plugins>
      </pluginManagement>
      <plugins>
          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-failsafe-plugin</artifactId>
              <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>3.1.0</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>org.kasource</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>
      <!-- JaCoCo Profile -->
      <profile>
          <id>jacoco</id>
          <activation>
              <property>
                  <name>run.qa</name>
                  <value>true</value>
              </property>
              <jdk>(1.7,)</jdk>
          </activation>
          <properties>
              <jacoco.skip>false</jacoco.skip>
              <jacoco.version>0.8.5</jacoco.version>
              <jacoco.line.coverage>0.80</jacoco.line.coverage>
              <jacoco.branch.coverage>0.80</jacoco.branch.coverage>
          </properties>

          <reporting>
              <plugins>
                  <plugin>
                      <groupId>org.jacoco</groupId>
                      <artifactId>jacoco-maven-plugin</artifactId>
                      <version>${jacoco.version}</version>
                      <reportSets>
                          <reportSet>
                              <reports>
                                  <report>report</report>
                              </reports>
                          </reportSet>
                      </reportSets>
                  </plugin>
              </plugins>
          </reporting>

          <build>
              <plugins>
                  <plugin>
                      <groupId>org.jacoco</groupId>
                      <artifactId>jacoco-maven-plugin</artifactId>
                      <version>${jacoco.version}</version>
                      <configuration>
                          <skip>${jacoco.skip}</skip>
                      </configuration>
                      <executions>
                          <execution>
                              <goals>
                                  <goal>prepare-agent</goal>
                              </goals>
                          </execution>
                          <execution>
                              <id>jacoco-check</id>
                              <goals>
                                  <goal>check</goal>
                              </goals>
                              <configuration>
                                  <rules>
                                      <rule>
                                          <element>BUNDLE</element>
                                          <limits>
                                              <limit>
                                                  <counter>LINE</counter>
                                                  <value>COVEREDRATIO</value>
                                                  <minimum>${jacoco.line.coverage}</minimum>
                                              </limit>
                                              <limit>
                                                  <counter>BRANCH</counter>
                                                  <value>COVEREDRATIO</value>
                                                  <minimum>${jacoco.branch.coverage}</minimum>
                                              </limit>
                                          </limits>
                                      </rule>
                                  </rules>
                              </configuration>
                          </execution>
                      </executions>
                  </plugin>
              </plugins>
          </build>

      </profile>

      <!-- Cobertura Profile -->
      <profile>
          <id>cobertura</id>
          <activation>
              <property>
                  <name>run.qa</name>
                  <value>true</value>
              </property>
              <jdk>[1.3,1.8)</jdk>
          </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>
                              <formats>
                                  <format>html</format>
                                  <format>xml</format>
                              </formats>
                              <check>
                                  <haltOnFailure>${cobertura.haltOnFailure}</haltOnFailure>
                                  <totalBranchRate>${cobertura.totalBranchRate}</totalBranchRate>
                                  <totalLineRate>${cobertura.totalLineRate}</totalLineRate>
                              </check>
                              <instrumentation>
                                  <ignoreTrivial>true</ignoreTrivial>
                                  <ignoreMethodAnnotations>
                                      <ignoreMethodAnnotation>org.kasource.qa.annotation.CoverageIgnore</ignoreMethodAnnotation>
                                      <ignoreMethodAnnotation>org.kasource.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.12.0</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>org.kasource</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>

      <!-- Findbugs profile -->
      <profile>
          <id>findbugs</id>
          <activation>
              <property>
                  <name>run.qa</name>
                  <value>true</value>
              </property>
              <jdk>[1.3,1.8)</jdk>
          </activation>
          <properties>
              <findbugs.maven.version>3.0.5</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>

      <!-- Spotbugs -->
      <profile>
          <id>spotbugs</id>
          <activation>
              <property>
                  <name>run.qa</name>
                  <value>true</value>
              </property>
              <jdk>(1.7,)</jdk>
          </activation>
          <properties>
              <spotbugs.maven.version>3.1.12.2</spotbugs.maven.version>
              <spotbugs.failOnError>true</spotbugs.failOnError>
              <spotbugs.skip>false</spotbugs.skip>
              <spotbugs.effort>Max</spotbugs.effort>
              <spotbugs.threshold>Low</spotbugs.threshold>
          </properties>


          <reporting>
              <plugins>
                  <plugin>
                      <groupId>com.github.spotbugs</groupId>
                      <artifactId>spotbugs-maven-plugin</artifactId>
                      <configuration>
                          <xmlOutput>true</xmlOutput>
                          <xmlOutputDirectory>target/site</xmlOutputDirectory>
                      </configuration>
                  </plugin>
              </plugins>
          </reporting>

          <build>
              <pluginManagement>
                  <plugins>
                      <plugin>
                          <groupId>com.github.spotbugs</groupId>
                          <artifactId>spotbugs-maven-plugin</artifactId>
                          <version>${spotbugs.maven.version}</version>
                      </plugin>
                  </plugins>
              </pluginManagement>
              <plugins>
                  <plugin>
                      <groupId>com.github.spotbugs</groupId>
                      <artifactId>spotbugs-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>
                      <configuration>
                          <links>
                              <link>https://docs.oracle.com/javase/${jdk.version}/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>
                          <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>
      <profile>
          <id>dependency-check</id>
          <activation>
              <property>
                  <name>run.qa</name>
                  <value>true</value>
              </property>
          </activation>
          <properties>
              <dependencyCheck.skip>false</dependencyCheck.skip>
              <dependencyCheck.version>5.2.4</dependencyCheck.version>
              <dependencyCheck.skipProvidedScope>false</dependencyCheck.skipProvidedScope>
              <dependencyCheck.skipRuntimeScope>false</dependencyCheck.skipRuntimeScope>
              <dependencyCheck.skipSystemScope>false</dependencyCheck.skipSystemScope>
              <dependencyCheck.skipTestScope>true</dependencyCheck.skipTestScope>
              <dependencyCheck.failBuildOnCVSS>11</dependencyCheck.failBuildOnCVSS>
              <dependencyCheck.failBuildOnAnyVulnerability>false</dependencyCheck.failBuildOnAnyVulnerability>
              <dependencyCheck.failOnError>true</dependencyCheck.failOnError>
              <dependencyCheck.format>HTML</dependencyCheck.format>
              <dependencyCheck.prettyPrint>true</dependencyCheck.prettyPrint>
          </properties>
          <reporting>
              <plugins>
                  <plugin>
                      <groupId>org.owasp</groupId>
                      <artifactId>dependency-check-maven</artifactId>
                      <version>${dependencyCheck.version}</version>
                      <configuration>
                          <format>${dependencyCheck.format}</format>
                          <prettyPrint>${dependencyCheck.prettyPrint}</prettyPrint>
                      </configuration>
                  </plugin>
              </plugins>
          </reporting>
          <build>
              <pluginManagement>
                  <plugins>
                      <plugin>
                          <groupId>org.owasp</groupId>
                          <artifactId>dependency-check-maven</artifactId>
                          <version>${dependencyCheck.version}</version>
                          <configuration>
                              <skip>${dependencyCheck.skip}</skip>
                              <skipProvidedScope>${dependencyCheck.skipProvidedScope}</skipProvidedScope>
                              <skipRuntimeScope>${dependencyCheck.skipRuntimeScope}</skipRuntimeScope>
                              <skipSystemScope>${dependencyCheck.skipSystemScope}</skipSystemScope>
                              <skipTestScope>${dependencyCheck.skipTestScope}</skipTestScope>
                              <failBuildOnCVSS>${dependencyCheck.failBuildOnCVSS}</failBuildOnCVSS>
                              <failBuildOnAnyVulnerability>${dependencyCheck.failBuildOnAnyVulnerability}</failBuildOnAnyVulnerability>
                              <failOnError>${dependencyCheck.failOnError}</failOnError>
                          </configuration>
                      </plugin>
                  </plugins>
              </pluginManagement>
              <plugins>
                  <plugin>
                      <groupId>org.owasp</groupId>
                      <artifactId>dependency-check-maven</artifactId>
                      <executions>
                          <execution>
                              <goals>
                                  <goal>check</goal>
                              </goals>
                          </execution>
                      </executions>
                  </plugin>
              </plugins>
          </build>
      </profile>
      <profile>
          <id>javadoc-9</id>
          <activation>
              <jdk>(1.8,)</jdk>
          </activation>
          <build>
              <pluginManagement>
                  <plugins>
                      <plugin>
                          <groupId>org.apache.maven.plugins</groupId>
                          <artifactId>maven-javadoc-plugin</artifactId>
                          <version>3.1.1</version>
                          <configuration>
                              <additionalOptions>
                                  <additionalOption>-html5</additionalOption>
                                  <additionalOption>-Xdoclint:none</additionalOption>
                              </additionalOptions>
                          </configuration>
                      </plugin>
                  </plugins>
              </pluginManagement>
          </build>
      </profile>
  </profiles>
</project>
