<?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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.cerner.bunsen</groupId>
  <artifactId>bunsen-parent</artifactId>
  <packaging>pom</packaging>
  <version>0.5.7</version>
  <name>Bunsen Parent</name>
  <description>Use FHIR resources as native Spark data sets</description>
  <url>http://engineering.cerner.com/bunsen</url>

  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>

  <properties>

    <compile.source>1.8</compile.source>

    <!-- Spark -->
    <spark.version>2.4.4</spark.version>
    <scala.version>2.11.8</scala.version>
    <scala.binary.version>2.11</scala.binary.version>
    <hapi.fhir.version>3.3.0</hapi.fhir.version>
    <avro.version>1.8.2</avro.version>
    <junit.version>4.11</junit.version>
    <scm.url>http://github.com/cerner/bunsen/tree/master/</scm.url>
    <scm.connection>scm:git:git@github.com/cerner/bunsen.git</scm.connection>
    <python.version>3.5.3</python.version>
    <maven-javadoc.plugin.version>2.10.3</maven-javadoc.plugin.version>
    <maven-project-info-reports.plugin.version>2.9</maven-project-info-reports.plugin.version>
  </properties>

  <modules>
    <module>bunsen-core</module>
    <module>bunsen-core-stu3</module>
    <module>bunsen-uscore-resources-stu3</module>
    <module>bunsen-spark</module>
    <module>bunsen-spark-stu3</module>
    <module>bunsen-avro</module>
    <module>bunsen-avro-records-stu3</module>
    <module>bunsen-spark-shaded</module>
    <module>python</module>
    <module>assembly</module>
  </modules>

  <scm>
    <connection>${scm.connection}</connection>
    <url>${scm.url}</url>
    <tag>0.5.7</tag>
  </scm>

  <developers>
    <developer>
      <id>RB4106</id>
      <name>Ryan Brush</name>
      <email>rbrush@cerner.com</email>
      <url>https://github.com/rbrush</url>
      <roles>
        <role>architect</role>
        <role>developer</role>
      </roles>
      <timezone>-6</timezone>
    </developer>
  </developers>

  <build>
    <plugins>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
      </plugin>

      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>generate-resources</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>resources</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <nonFilteredFileExtensions>
            <!-- Exclude our jar resources from pre-processing, avoids binary corruption -->
            <nonFilteredFileExtension>jar</nonFilteredFileExtension>
          </nonFilteredFileExtensions>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <showDeprecation>true</showDeprecation>
          <showWarnings>true</showWarnings>
          <source>${compile.source}</source>
          <target>${compile.source}</target>
        </configuration>
      </plugin>

      <plugin>
        <artifactId>maven-source-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

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

      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
        <configuration>
          <failOnError>true</failOnError>
        </configuration>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
          <execution>
            <id>aggregate</id>
            <goals>
              <goal>aggregate</goal>
            </goals>
            <phase>site</phase>
            <configuration>
              <!-- Specific configuration for the aggregate report -->
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <executions>
          <execution>

            <id>verify_checkstyleReport</id>
            <phase>verify</phase>
            <goals>
              <goal>checkstyle</goal>
            </goals>
            <configuration>
              <configLocation>google_checks.xml</configLocation>
              <encoding>UTF-8</encoding>
              <consoleOutput>false</consoleOutput>
              <enableRulesSummary>true</enableRulesSummary>
              <enableFilesSummary>true</enableFilesSummary>
              <includeTestSourceDirectory>true</includeTestSourceDirectory>
              <linkXRef>true</linkXRef>
            </configuration>
          </execution>
          <execution>

            <id>verify_checkstyleCheck</id>
            <goals>
              <goal>check</goal>
            </goals>
            <configuration>
              <configLocation>google_checks.xml</configLocation>
              <encoding>UTF-8</encoding>
              <consoleOutput>true</consoleOutput>
              <failOnViolation>true</failOnViolation>
              <includeTestSourceDirectory>true</includeTestSourceDirectory>
              <violationSeverity>warning</violationSeverity>
              <maxAllowedViolations>0</maxAllowedViolations>
            </configuration>
          </execution>
        </executions>
      </plugin>

    </plugins>

    <pluginManagement>
      <plugins>

        <plugin>
          <artifactId>maven-resources-plugin</artifactId>
          <version>2.6</version>
        </plugin>

        <plugin>
          <artifactId>maven-source-plugin</artifactId>
          <version>2.2.1</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>2.4</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.0</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-shade-plugin</artifactId>
          <version>2.2</version>
        </plugin>

        <plugin>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.5</version>
          <configuration>
              <tagNameFormat>@{project.version}</tagNameFormat>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>2.9.1</version>
        </plugin>

        <plugin>
          <groupId>org.apache.avro</groupId>
          <artifactId>avro-maven-plugin</artifactId>
          <version>${avro.version}</version>
        </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-enforcer-plugin</artifactId>
                    <versionRange>[1.0.0,)</versionRange>
                    <goals>
                      <goal>enforce</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-scm-plugin</artifactId>
                    <versionRange>[1.8.1,)</versionRange>
                    <goals>
                      <goal>checkout</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>

        <plugin>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>3.1.0</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-scm-plugin</artifactId>
          <version>1.8.1</version>
        </plugin>

        <plugin>
          <groupId>net.alchim31.maven</groupId>
          <artifactId>scala-maven-plugin</artifactId>
          <version>3.3.2</version>
          <executions>
            <execution>
              <id>scala-compile-first</id>
              <phase>process-resources</phase>
              <goals>
                <goal>add-source</goal>
                <goal>compile</goal>
              </goals>
            </execution>
            <execution>
              <id>scala-test-compile</id>
              <phase>process-test-resources</phase>
              <goals>
                <goal>testCompile</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin> <!-- Upgrading Checkstyle at Runtime -->
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <version>2.17</version>
          <dependencies>
            <dependency>
              <groupId>com.puppycrawl.tools</groupId>
              <artifactId>checkstyle</artifactId>
              <version>7.4</version>
            </dependency>
          </dependencies>
          <configuration>
            <configLocation>/google_checks.xml</configLocation>
            <enableFilesSummary>true</enableFilesSummary>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.12.1</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-report-plugin</artifactId>
          <version>2.14</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-project-info-reports-plugin</artifactId>
          <version>${maven-project-info-reports.plugin.version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>1.5</version>
          <executions>
            <execution>
              <id>sign-artifacts</id>
              <phase>verify</phase>
              <goals>
                <goal>sign</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.sonatype.plugins</groupId>
          <artifactId>nexus-staging-maven-plugin</artifactId>
          <version>1.6.7</version>
          <extensions>true</extensions>
          <configuration>
            <serverId>ossrh</serverId>
            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
            <autoReleaseAfterClose>false</autoReleaseAfterClose>
          </configuration>
        </plugin>

      </plugins>

    </pluginManagement>
  </build>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <configuration>
          <configLocation>google_checks.xml</configLocation>
        </configuration>
        <reportSets>
          <reportSet>
            <reports>
              <report>checkstyle</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>

      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
        <configuration>
          <docfilessubdirs>true</docfilessubdirs>
          <detectLinks>true</detectLinks>
          <detectJavaApiLink>true</detectJavaApiLink>
          <show>protected</show>
          <source>${compile.source}</source>
          <doctitle>${project.name}-${project.version} API</doctitle>
          <windowtitle>${project.name}-${project.version} API</windowtitle>
          <name>JavaDoc</name>
        </configuration>
        <reportSets>
          <reportSet>
            <reports>
              <report>javadoc</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>

      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <configuration>
          <ignoredUsedUndeclaredDependencies>
            <ignoreUsedUndeclaredDependency>org.slf4j</ignoreUsedUndeclaredDependency>
          </ignoredUsedUndeclaredDependencies>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <argLine>-Xmx4096m -Djava.net.preferIPv4Stack=true</argLine>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-report-plugin</artifactId>
        <reportSets>
          <reportSet>
            <reports>
              <report>report-only</report>
              <report>failsafe-report-only</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <reportSets>
          <reportSet>
            <reports>
              <report>index</report>
              <report>project-team</report>
              <report>summary</report>
              <report>issue-tracking</report>
              <report>scm</report>
              <report>dependencies</report>
            </reports>
          </reportSet>
        </reportSets>
        <configuration>
          <dependencyDetailsEnabled>false</dependencyDetailsEnabled>
          <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
        </configuration>
      </plugin>

    </plugins>
  </reporting>

  <dependencyManagement>
    <dependencies>

      <!-- Project libraries -->
      <dependency>
        <groupId>com.cerner.bunsen</groupId>
        <artifactId>bunsen-core</artifactId>
        <version>${project.version}</version>
      </dependency>

      <dependency>
        <groupId>com.cerner.bunsen</groupId>
        <artifactId>bunsen-stu3</artifactId>
        <version>${project.version}</version>
      </dependency>

      <dependency>
        <groupId>com.cerner.bunsen</groupId>
        <artifactId>bunsen-core-stu3</artifactId>
        <version>${project.version}</version>
      </dependency>

      <dependency>
        <groupId>com.cerner.bunsen</groupId>
        <artifactId>bunsen-core-stu3</artifactId>
        <type>test-jar</type>
        <version>${project.version}</version>
      </dependency>

      <dependency>
        <groupId>com.cerner.bunsen</groupId>
        <artifactId>bunsen-spark</artifactId>
        <version>${project.version}</version>
      </dependency>

      <dependency>
        <groupId>com.cerner.bunsen</groupId>
        <artifactId>bunsen-spark-stu3</artifactId>
        <version>${project.version}</version>
      </dependency>

      <dependency>
        <groupId>com.cerner.bunsen</groupId>
        <artifactId>bunsen-uscore-resources-stu3</artifactId>
        <version>${project.version}</version>
      </dependency>

      <dependency>
        <groupId>com.cerner.bunsen</groupId>
        <artifactId>bunsen-uscore-resources-stu3</artifactId>
        <type>test-jar</type>
        <version>${project.version}</version>
      </dependency>

      <dependency>
        <groupId>com.cerner.bunsen</groupId>
        <artifactId>bunsen-avro</artifactId>
        <version>${project.version}</version>
      </dependency>

      <dependency>
        <groupId>com.cerner.bunsen</groupId>
        <artifactId>bunsen-avro-stu3</artifactId>
        <version>${project.version}</version>
      </dependency>

      <dependency>
        <groupId>com.cerner.bunsen</groupId>
        <artifactId>bunsen-r4</artifactId>
        <version>${project.version}</version>
      </dependency>

      <dependency>
        <groupId>com.cerner.bunsen</groupId>
        <artifactId>bunsen-spark-shaded</artifactId>
        <version>${project.version}</version>
      </dependency>

      <dependency>
        <groupId>com.cerner.bunsen</groupId>
        <artifactId>bunsen-python</artifactId>
        <version>${project.version}</version>
      </dependency>

      <!-- Spark -->
      <dependency>
        <groupId>org.apache.spark</groupId>
        <artifactId>spark-core_${scala.binary.version}</artifactId>
        <version>${spark.version}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>org.apache.spark</groupId>
        <artifactId>spark-sql_${scala.binary.version}</artifactId>
        <version>${spark.version}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>org.apache.spark</groupId>
        <artifactId>spark-hive_${scala.binary.version}</artifactId>
        <version>${spark.version}</version>
        <scope>provided</scope>
      </dependency>

      <!-- FHIR dependencies -->
      <dependency>
        <groupId>ca.uhn.hapi.fhir</groupId>
        <artifactId>hapi-fhir-base</artifactId>
        <version>${hapi.fhir.version}</version>
      </dependency>

      <dependency>
        <groupId>ca.uhn.hapi.fhir</groupId>
        <artifactId>hapi-fhir-utilities</artifactId>
        <version>${hapi.fhir.version}</version>
      </dependency>

      <!-- HAPI FHIR DSTU3 -->
      <dependency>
        <groupId>ca.uhn.hapi.fhir</groupId>
        <artifactId>hapi-fhir-validation-resources-dstu3</artifactId>
        <version>${hapi.fhir.version}</version>
      </dependency>

      <dependency>
        <groupId>ca.uhn.hapi.fhir</groupId>
        <artifactId>hapi-fhir-validation</artifactId>
        <version>${hapi.fhir.version}</version>
      </dependency>

      <dependency>
        <groupId>ca.uhn.hapi.fhir</groupId>
        <artifactId>hapi-fhir-structures-dstu3</artifactId>
        <version>${hapi.fhir.version}</version>
      </dependency>

      <!-- HAPI FHIR R4 -->
      <dependency>
        <groupId>ca.uhn.hapi.fhir</groupId>
        <artifactId>hapi-fhir-validation-resources-r4</artifactId>
        <version>${hapi.fhir.version}</version>
      </dependency>

      <dependency>
        <groupId>ca.uhn.hapi.fhir</groupId>
        <artifactId>hapi-fhir-structures-r4</artifactId>
        <version>${hapi.fhir.version}</version>
      </dependency>

      <!-- Avro dependencies -->
      <dependency>
        <groupId>org.apache.avro</groupId>
        <artifactId>avro</artifactId>
        <version>${avro.version}</version>
      </dependency>

      <dependency>
        <groupId>org.apache.avro</groupId>
        <artifactId>avro-compiler</artifactId>
        <version>${avro.version}</version>
      </dependency>

      <!-- Test dependencies -->
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>${junit.version}</version>
        <scope>test</scope>
      </dependency>

      <dependency>
        <groupId> org.apache.hadoop</groupId>
        <artifactId>hadoop-client</artifactId>
        <version>2.7.3</version>
      </dependency>

    </dependencies>
  </dependencyManagement>

  <repositories>
    <repository>
      <id>sonatype</id>
      <url>https://oss.sonatype.org/content/groups/public/</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

  <distributionManagement>
    <snapshotRepository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
    <repository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
  </distributionManagement>

  <profiles>
    <profile>
      <id>ossrh</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>1.6.7</version>
            <extensions>true</extensions>
            <configuration>
              <serverId>ossrh</serverId>
              <nexusUrl>https://oss.sonatype.org/</nexusUrl>
              <autoReleaseAfterClose>false</autoReleaseAfterClose>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>2.2.1</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>${maven-javadoc.plugin.version}</version>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.5</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
