<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>

  <groupId>com.expediagroup</groupId>
  <artifactId>eg-oss-parent</artifactId>
  <version>2.4.0</version>
  <description>Parent POM for Expedia Group open source projects</description>
  <packaging>pom</packaging>
  <url>https://github.com/ExpediaGroup/eg-oss-parent</url>
  <inceptionYear>2019</inceptionYear>
  <name>Expedia Group Open Source Parent</name>

  <scm>
    <connection>scm:git:https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/ExpediaGroup/${project.artifactId}.git</connection>
    <developerConnection>scm:git:https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/ExpediaGroup/${project.artifactId}.git</developerConnection>
    <url>https://github.com/ExpediaGroup/eg-oss-parent</url>
    <tag>eg-oss-parent-2.4.0</tag>
  </scm>

  <organization>
    <name>Expedia Group</name>
    <url>http://expediagroup.com</url>
  </organization>

  <developers>
    <developer>
      <name>Expedia Group Committers</name>
      <organization>Expedia Group</organization>
      <organizationUrl>https://expediagroup.com</organizationUrl>
    </developer>
  </developers>

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

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

    <jdk.version>1.8</jdk.version>

    <buildnumber.maven.plugin.version>1.4</buildnumber.maven.plugin.version>
    <coveralls.maven.plugin.version>4.3.0</coveralls.maven.plugin.version>
    <eg.oss.plugin.config.version>1.2.0</eg.oss.plugin.config.version>
    <failsafe.maven.plugin.version>3.0.0-M5</failsafe.maven.plugin.version>
    <jacoco.version>0.8.6</jacoco.version>
    <javadoc.source.version>8</javadoc.source.version>
    <javadoc.source.detect.java.api.link>false</javadoc.source.detect.java.api.link>
    <license.maven.plugin.version>3.0</license.maven.plugin.version>
    <lifecycle.mapping.version>1.0.0</lifecycle.mapping.version>
    <maven.checkstyle.plugin.version>3.1.1</maven.checkstyle.plugin.version>
    <maven.compiler.plugin.version>3.8.1</maven.compiler.plugin.version>
    <maven.dependency.plugin.version>3.1.2</maven.dependency.plugin.version>
    <maven.gpg.plugin.version>1.6</maven.gpg.plugin.version>
    <maven.jar.plugin.version>3.2.0</maven.jar.plugin.version>
    <maven.javadoc.plugin.version>3.2.0</maven.javadoc.plugin.version>
    <maven.site.plugin.version>3.9.1</maven.site.plugin.version>
    <maven.source.plugin.version>3.2.0</maven.source.plugin.version>
    <maven.spotbugs.plugin.version>4.0.4</maven.spotbugs.plugin.version>
    <maven.surefire.plugin.version>3.0.0-M5</maven.surefire.plugin.version>
    <maven.release.plugin.version>3.0.0-M1</maven.release.plugin.version>
    <nexus.staging.maven.plugin.version>1.6.8</nexus.staging.maven.plugin.version>
    <spotless.maven.plugin.version>2.4.1</spotless.maven.plugin.version>
    <git.commit.id.maven.plugin.version>4.0.3</git.commit.id.maven.plugin.version>
    <jib.maven.plugin.version>2.7.1</jib.maven.plugin.version>

    <docker.registry>expediagroup</docker.registry>
    <dockerhub.url>docker.io</dockerhub.url>
    <!-- default docker image 'from' references (can be overridden in child projects if needed) -->
    <docker.from.image>openjdk</docker.from.image>
    <docker.from.tag>8u181-jdk-slim-stretch</docker.from.tag>
    <docker.from.reference>${docker.from.image}:${docker.from.tag}</docker.from.reference>
    <!-- default docker image 'to' references -->
    <docker.to.image>${project.artifactId}</docker.to.image>
    <docker.to.tag>${project.version}</docker.to.tag>
    <docker.to.reference>${dockerhub.url}/${docker.registry}/${docker.to.image}:${docker.to.tag}</docker.to.reference>
    <docker.container.port>8080</docker.container.port>

    <!-- EG specific plugin properties -->
    <checkstyle.config>${project.build.directory}/plugin-config/checkstyle/eg-checkstyle.xml</checkstyle.config>
    <mycila.config.header>${project.build.directory}/plugin-config/mycila/APACHE-2.txt</mycila.config.header>
    <mycila.config.header.def>${project.build.directory}/plugin-config/mycila/eg-definitions.xml</mycila.config.header.def>
    <spotbugs.config>${project.build.directory}/plugin-config/spotbugs/eg-spotbugs-exclude.xml</spotbugs.config>
  </properties>

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

  <build>
    <plugins>
      <plugin>
        <groupId>com.diffplug.spotless</groupId>
        <artifactId>spotless-maven-plugin</artifactId>
        <version>${spotless.maven.plugin.version}</version>
        <executions>
          <execution>
            <phase>process-sources</phase>
            <goals>
              <goal>apply</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <java>
            <removeUnusedImports />
            <importOrder>
              <order>\#java,\#javax,\#org,\#,\#com,\#com.expedia,\#com.expediagroup,\#com.hotels,java,javax,org,,com,com.expedia,com.expediagroup,com.hotels</order>
            </importOrder>
          </java>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-maven-plugin</artifactId>
        <version>${maven.spotbugs.plugin.version}</version>
        <configuration>
          <encoding>${project.build.sourceEncoding}</encoding>
          <xmlOutput>true</xmlOutput>
          <effort>Max</effort>
          <threshold>Low</threshold>
          <excludeFilterFile>${spotbugs.config}</excludeFilterFile>
        </configuration>
      </plugin>
      <plugin>
        <!-- this is an exception to alphabetical sorting rules of plugins since we need it to run 
             the "validate" phase *before* some other plugings below -->
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>${maven.dependency.plugin.version}</version>
        <executions>
          <execution>
            <id>unpack</id>
            <phase>validate</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>com.expediagroup</groupId>
                  <artifactId>eg-oss-plugin-config</artifactId>
                  <version>${eg.oss.plugin.config.version}</version>
                  <type>jar</type>
                  <overWrite>false</overWrite>
                  <outputDirectory>${project.build.directory}/plugin-config</outputDirectory>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.mycila</groupId>
        <artifactId>license-maven-plugin</artifactId>
        <version>${license.maven.plugin.version}</version>
        <dependencies>
          <dependency>
            <groupId>com.expediagroup</groupId>
            <artifactId>eg-oss-plugin-config</artifactId>
            <version>${eg.oss.plugin.config.version}</version>
          </dependency>
          <dependency>
            <groupId>com.mycila</groupId>
            <artifactId>license-maven-plugin-git</artifactId>
            <version>${license.maven.plugin.version}</version>
          </dependency>
        </dependencies>
        <configuration>
          <header>${mycila.config.header}</header>
          <headerDefinitions>
            <headerDefinition>${mycila.config.header.def}</headerDefinition>
          </headerDefinitions>
          <properties>
            <owner>Expedia, Inc.</owner>
            <currentYear>${current.year}</currentYear>
          </properties>
          <includes>
            <include>src/main/java/**</include>
            <include>src/main/resources/*.xml</include>
            <include>src/test/java/**</include>
            <include>src/test/resources/*.xml</include>
          </includes>
        </configuration>
        <executions>
          <execution>
            <phase>validate</phase>
            <goals>
              <goal>format</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${maven.compiler.plugin.version}</version>
        <configuration>
          <source>${jdk.version}</source>
          <target>${jdk.version}</target>
          <encoding>${project.build.sourceEncoding}</encoding>
          <showWarnings>true</showWarnings>
          <parameters>true</parameters>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>${maven.checkstyle.plugin.version}</version>
        <configuration>
          <configLocation>${checkstyle.config}</configLocation>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>${maven.jar.plugin.version}</version>
        <configuration>
          <archive>
            <manifestEntries>
              <Build-Version>${project.version}</Build-Version>
              <Build-DateTime>${maven.build.timestamp}</Build-DateTime>
              <Maven-GroupId>${project.groupId}</Maven-GroupId>
              <Maven-ArtifactId>${project.artifactId}</Maven-ArtifactId>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>${maven.javadoc.plugin.version}</version>
        <configuration>
          <encoding>${project.build.sourceEncoding}</encoding>
          <source>${javadoc.source.version}</source>
          <detectJavaApiLink>${javadoc.source.detect.java.api.link}</detectJavaApiLink>
        </configuration>
        <executions>
          <execution>
            <id>aggregate</id>
            <goals>
              <goal>aggregate</goal>
            </goals>
            <phase>site</phase>
          </execution>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>${maven.release.plugin.version}</version>
        <configuration>
          <autoVersionSubmodules>true</autoVersionSubmodules>
          <useReleaseProfile>false</useReleaseProfile>
          <releaseProfiles>sonatype-oss-release</releaseProfiles>
          <goals>deploy</goals>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${maven.surefire.plugin.version}</version>
      </plugin>
      <!-- used to determine the current year -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>buildnumber-maven-plugin</artifactId>
        <version>${buildnumber.maven.plugin.version}</version>
        <executions>
          <execution>
            <phase>validate</phase>
            <goals>
              <goal>create-timestamp</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <timestampFormat>yyyy</timestampFormat>
          <timestampPropertyName>current.year</timestampPropertyName>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${jacoco.version}</version>
        <executions>
          <execution>
            <id>jacoco-initialize</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>jacoco-site</id>
            <phase>package</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.sonatype.plugins</groupId>
        <artifactId>nexus-staging-maven-plugin</artifactId>
        <version>${nexus.staging.maven.plugin.version}</version>
        <extensions>true</extensions>
        <configuration>
          <serverId>sonatype-nexus-staging</serverId>
          <nexusUrl>https://oss.sonatype.org/</nexusUrl>
          <autoReleaseAfterClose>true</autoReleaseAfterClose>
        </configuration>
      </plugin>
    </plugins>

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>${maven.site.plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>failsafe-maven-plugin</artifactId>
          <version>${failsafe.maven.plugin.version}</version>
          <executions>
            <execution>
              <id>integration-test</id>
              <goals>
                <goal>integration-test</goal>
              </goals>
            </execution>
            <execution>
              <id>verify</id>
              <goals>
                <goal>verify</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>pl.project13.maven</groupId>
          <artifactId>git-commit-id-plugin</artifactId>
          <version>${git.commit.id.maven.plugin.version}</version>
          <executions>
            <execution>
              <id>get-git-info</id>
              <phase>initialize</phase>
              <goals>
                <goal>revision</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <generateGitPropertiesFile>false</generateGitPropertiesFile>
            <dateFormat>yyyy-MM-dd'T'HH:mm:ss'Z'</dateFormat>
            <dateFormatTimeZone>GMT</dateFormatTimeZone>
            <includeOnlyProperties>
              <includeOnlyProperty>^git.commit.time$</includeOnlyProperty>
            </includeOnlyProperties>
          </configuration>
        </plugin>
        <plugin>
          <groupId>com.google.cloud.tools</groupId>
          <artifactId>jib-maven-plugin</artifactId>
          <version>${jib.maven.plugin.version}</version>
          <executions>
            <execution>
              <id>deploy</id>
              <phase>deploy</phase>
              <goals>
                <goal>build</goal>
              </goals>
            </execution>
            <execution>
              <id>package</id>
              <phase>package</phase>
              <goals>
                <goal>dockerBuild</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <from>
              <image>${docker.from.reference}</image>
            </from>
            <to>
              <image>${docker.to.reference}</image>
              <auth>
                <username>${DOCKERHUB_USERNAME}</username>
                <password>${DOCKERHUB_PASSWORD}</password>
              </auth>
            </to>
            <container>
              <creationTime>${git.commit.time}</creationTime>
              <filesModificationTime>${git.commit.time}</filesModificationTime>
              <ports>
                <port>${docker.container.port}</port>
              </ports>
            </container>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <profiles>
    <profile>
      <id>doclint-java8-disable</id>
      <activation>
        <jdk>[1.8,)</jdk>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <configuration>
              <doclint>none</doclint>
            </configuration>
          </plugin>
        </plugins>
      </build>
      <reporting>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <configuration>
              <doclint>none</doclint>
            </configuration>
          </plugin>
        </plugins>
      </reporting>
    </profile>
    <profile>
      <id>surefire-configuration</id>
      <activation>
        <property>
          <name>test.arguments</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${maven.surefire.plugin.version}</version>
            <configuration>
              <argLine>@{argLine} ${test.arguments}</argLine>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
<!--
        The profile `sonatype-oss-release` is going to be deprecated in the future because we will use
        `sonatype-oss-release-github-actions` instead, which allows to do releases in Github instead of Jenkins.
        The `sonatype-oss-release-github-actions` profile doesn't work in Jenkins so we will leave it here for
        backwards compatibility, but you should migrate to use that one whenever it is possible.
-->
    <profile>
      <id>sonatype-oss-release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>${maven.gpg.plugin.version}</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>${maven.source.plugin.version}</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>sonatype-oss-release-github-actions</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>${maven.gpg.plugin.version}</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
                <configuration>
                  <!-- Prevent `gpg` from using pinentry programs -->
                  <gpgArguments>
                    <arg>--pinentry-mode</arg>
                    <arg>loopback</arg>
                  </gpgArguments>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>${maven.source.plugin.version}</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>coveralls</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.eluder.coveralls</groupId>
            <artifactId>coveralls-maven-plugin</artifactId>
            <version>${coveralls.maven.plugin.version}</version>
            <dependencies>
              <dependency>
                <!-- TODO: this can be removed when a version of coveralls-maven-plugin
                  that supports Java >=11 is released -->
                <groupId>javax.xml.bind</groupId>
                <artifactId>jaxb-api</artifactId>
                <version>2.2.3</version>
              </dependency>
            </dependencies>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>${maven.checkstyle.plugin.version}</version>
        <configuration>
          <configLocation>${checkstyle.config}</configLocation>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>${maven.javadoc.plugin.version}</version>
        <configuration>
          <encoding>${project.build.sourceEncoding}</encoding>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <version>${maven.project.info.reports.plugin.version}</version>
        <reportSets>
          <reportSet>
            <reports>
              <report>index</report>
              <report>dependencies</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <version>${maven.site.plugin.version}</version>
        <configuration>
          <outputEncoding>UTF-8</outputEncoding>
        </configuration>
      </plugin>
    </plugins>
  </reporting>

</project>
