<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.pentaho</groupId>
    <artifactId>pentaho-ce-parent-pom</artifactId>
    <version>7.1.0.0-12</version>
  </parent>
  <groupId>org.pentaho</groupId>
  <artifactId>pentaho-ce-jar-parent-pom</artifactId>
  <version>7.1.0.0-12</version>
  <packaging>pom</packaging>
  <name>Pentaho Community Edition Project Parent POM For Java Projects</name>
  <modules>
    <module>pentaho-ce-bundle-parent-pom</module>
  </modules>
  <properties>
    <maven-surefire-plugin.reuseForks>true</maven-surefire-plugin.reuseForks>
    <source.jdk.version>1.8</source.jdk.version>
    <checkstyle-properties-url>http://nexus.pentaho.org/content/groups/omni/com/pentaho/pentaho-coding-standards/checkstyle-maven-properties/${pentaho-coding-standards.version}/checkstyle-maven-properties-${pentaho-coding-standards.version}.properties</checkstyle-properties-url>
    <sonar.branch>${SCM_BRANCH}</sonar.branch>
    <sonar.project.name>${project.artifactId}</sonar.project.name>
    <checkstyle-config-url>http://nexus.pentaho.org/content/groups/omni/com/pentaho/pentaho-coding-standards/pentaho-checkstyle/${pentaho-coding-standards.version}/pentaho-checkstyle-${pentaho-coding-standards.version}.xml</checkstyle-config-url>
    <sonar.host.url>http://sonar.pentaho.com:9000</sonar.host.url>
    <maven-failsafe-plugin.reuseForks>true</maven-failsafe-plugin.reuseForks>
    <maven-failsafe-plugin.forkCount>1</maven-failsafe-plugin.forkCount>
    <junit.version>4.11</junit.version>
    <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
    <sonar.language>java</sonar.language>
    <sonar.jacoco.itReportPath>${project.build.directory}/jacoco-it.exec</sonar.jacoco.itReportPath>
    <SCM_BRANCH>master</SCM_BRANCH>
    <sonar.projectName>${sonar.project.name}</sonar.projectName>
    <maven-surefire-plugin.forkCount>1</maven-surefire-plugin.forkCount>
    <sonar.jacoco.reportPath>${project.build.directory}/jacoco.exec</sonar.jacoco.reportPath>
    <target.jdk.version>1.8</target.jdk.version>
    <pentaho-coding-standards.version>1.0.5</pentaho-coding-standards.version>
    <maven-surefire-plugin.testFailureIgnore>false</maven-surefire-plugin.testFailureIgnore>
  </properties>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <configuration>
            <source>${source.jdk.version}</source>
            <target>${target.jdk.version}</target>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <configuration>
            <archive>
              <manifest>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
              </manifest>
              <manifestEntries>
                <Source-Java-Version>${source.jdk.version}</Source-Java-Version>
                <Target-Java-Version>${target.jdk.version}</Target-Java-Version>
              </manifestEntries>
            </archive>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>test-unit-jacoco-agent-prep</id>
            <phase>${test-unit-jacoco-agent-prep-phase}</phase>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
            <configuration>
              <propertyName>surefireArgLine</propertyName>
            </configuration>
          </execution>
          <execution>
            <id>test-unit-jacoco-report</id>
            <phase>${test-unit-jacoco-report-phase}</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <executions>
          <execution>
            <id>default-test</id>
            <phase>${test-unit-execute-phase}</phase>
            <goals>
              <goal>test</goal>
            </goals>
            <configuration>
              <argLine>${surefireArgLine}</argLine>
              <forkCount>${maven-surefire-plugin.forkCount}</forkCount>
              <reuseForks>${maven-surefire-plugin.reuseForks}</reuseForks>
              <testFailureIgnore>${maven-surefire-plugin.testFailureIgnore}</testFailureIgnore>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-source-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-sources</id>
            <phase>${attach-sources-phase}</phase>
            <goals>
              <goal>jar-no-fork</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>test-integration</id>
      <activation>
        <property>
          <name>runITs</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <executions>
              <execution>
                <id>test-integration_add-resources</id>
                <phase>${test-integration_add-resources-phase}</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration>
                  <outputDirectory>${project.build.directory}/it-classes</outputDirectory>
                  <resources>
                    <resource>
                      <directory>${integration-test.resources}</directory>
                    </resource>
                  </resources>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>test-integration_add-source</id>
                <phase>${test-integration_add-source-phase}</phase>
                <goals>
                  <goal>add-test-source</goal>
                </goals>
                <configuration>
                  <sources>
                    <source>${integration-test.src}</source>
                  </sources>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>test-integration_jacoco-agent-prep</id>
                <phase>${test-integration_jacoco-agent-prep-phase}</phase>
                <goals>
                  <goal>prepare-agent-integration</goal>
                </goals>
                <configuration>
                  <propertyName>failsafeArgLine</propertyName>
                </configuration>
              </execution>
              <execution>
                <id>test-integration_jacoco-report</id>
                <phase>${test-integration_jacoco-report-phase}</phase>
                <goals>
                  <goal>report-integration</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <executions>
              <execution>
                <id>test-integration_compile</id>
                <phase>${test-integration_compile-phase}</phase>
                <goals>
                  <goal>testCompile</goal>
                </goals>
                <configuration>
                  <testExcludes>
                    <testExcludes>**/*Test.java</testExcludes>
                  </testExcludes>
                  <outputDirectory>${project.build.directory}/it-classes</outputDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <executions>
              <execution>
                <id>test-integration_execute</id>
                <phase>${test-integration_execute-phase}</phase>
                <goals>
                  <goal>integration-test</goal>
                </goals>
              </execution>
              <execution>
                <id>test-integration_report</id>
                <phase>${test-integration_report-phase}</phase>
                <goals>
                  <goal>verify</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <argLine>${failsafeArgLine}</argLine>
              <forkCount>${maven-failsafe-plugin.forkCount}</forkCount>
              <reuseForks>${maven-failsafe-plugin.reuseForks}</reuseForks>
              <testClassesDirectory>${project.build.directory}/it-classes</testClassesDirectory>
              <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
            </configuration>
          </plugin>
        </plugins>
      </build>
      <properties>
        <integration-test.resources>src/it/resources</integration-test.resources>
        <integration-test.src>src/it/java</integration-test.src>
      </properties>
    </profile>
    <profile>
      <id>reporting</id>
      <activation>
        <property>
          <name>!maven.test.skip</name>
        </property>
      </activation>
      <reporting>
        <plugins>
          <plugin>
            <artifactId>maven-project-info-reports-plugin</artifactId>
            <configuration>
              <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
            </configuration>
          </plugin>
          <plugin>
            <artifactId>maven-jxr-plugin</artifactId>
            <reportSets>
              <reportSet>
                <id>jxr</id>
                <reports>
                  <report>jxr</report>
                </reports>
              </reportSet>
            </reportSets>
            <configuration>
              <linkJavadoc>true</linkJavadoc>
            </configuration>
          </plugin>
          <plugin>
            <artifactId>maven-javadoc-plugin</artifactId>
            <reportSets>
              <reportSet>
                <id>javadoc</id>
                <reports>
                  <report>javadoc</report>
                </reports>
              </reportSet>
            </reportSets>
            <configuration>
              <failOnError>false</failOnError>
            </configuration>
          </plugin>
          <plugin>
            <artifactId>maven-checkstyle-plugin</artifactId>
            <reportSets>
              <reportSet>
                <id>checkstyle</id>
                <reports>
                  <report>checkstyle</report>
                </reports>
              </reportSet>
            </reportSets>
            <configuration>
              <configLocation>${checkstyle-config-url}</configLocation>
              <propertiesLocation>${checkstyle-properties-url}</propertiesLocation>
              <linkXRef>true</linkXRef>
              <cacheFile />
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
          </plugin>
          <plugin>
            <artifactId>maven-surefire-report-plugin</artifactId>
            <reportSets>
              <reportSet>
                <id>unit-tests</id>
                <reports>
                  <report>report-only</report>
                </reports>
              </reportSet>
              <reportSet>
                <id>integration-tests</id>
                <reports>
                  <report>failsafe-report-only</report>
                </reports>
              </reportSet>
            </reportSets>
            <configuration>
              <linkXRef>true</linkXRef>
            </configuration>
          </plugin>
          <plugin>
            <artifactId>maven-site-plugin</artifactId>
          </plugin>
        </plugins>
      </reporting>
    </profile>
    <profile>
      <id>javadoc</id>
      <activation>
        <property>
          <name>javadoc</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-javadoc</id>
                <phase>package</phase>
                <goals>
                  <goal>jar</goal>
                </goals>
                <configuration>
                  <additionalparam>-Xdoclint:none</additionalparam>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>sonar</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>sonar-maven-plugin</artifactId>
            <version>${sonar-maven-plugin.version}</version>
            <executions>
              <execution>
                <id>sonar_publish</id>
                <configuration>
                  <sonarHostURL>${sonar.host.url}</sonarHostURL>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
