<!--
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License. See accompanying LICENSE file.
-->

<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>jp.co.yahoo.yosegi</groupId>
  <artifactId>yosegi-hive</artifactId>
  <version>2.0.0_hive-3.1.3</version>
  <packaging>jar</packaging>
  <name>Yosegi Hive</name>
  <description>Yosegi Hive library.</description>
  <url>https://github.com/yahoojapan/yosegi-hive</url>

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

  <scm>
    <connection>scm:git:git@github.com:yahoojapan/yosegi-hive.git</connection>
    <developerConnection>scm:git:git@github.com:yahoojapan/yosegi-hive.git</developerConnection>
    <url>scm:git:https://github.com/yahoojapan/yosegi-hive</url>
    <tag>yosegi-hive-2.0.0_hive-3.1.3</tag>
  </scm>

  <organization>
    <name>Yahoo Japan Corporation</name>
    <url>https://www.yahoo.co.jp/</url>
  </organization>

  <developers>
    <developer>
      <id>koijima</id>
      <name>Koji Ijima</name>
      <organization>Yahoo Japan Corporation</organization>
    </developer>
    <developer>
      <id>yoto</id>
      <name>Yasunori Ohto</name>
      <organization>Yahoo Japan Corporation</organization>
    </developer>
  </developers>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <target_jdk_version>1.8</target_jdk_version>
    <maven-surefire-plugin.version>3.0.0-M2</maven-surefire-plugin.version>
    <maven-surefire-report-plugin.version>${maven-surefire-plugin.version}</maven-surefire-report-plugin.version>
    <maven-clover2-plugin.version>4.0.6</maven-clover2-plugin.version>
    <buildtype>test</buildtype>
    <spotbugs-maven-plugin.version>3.1.8</spotbugs-maven-plugin.version>
    <spotbugs.version>3.1.9</spotbugs.version>
    <hive.base>3.1</hive.base>
    <hive.version>${hive.base}.3</hive.version>
  </properties>

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

  <dependencies>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-client</artifactId>
      <version>3.2.0</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.apache.hive</groupId>
      <artifactId>hive-exec</artifactId>
      <version>${hive.version}</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>2.9.10.8</version>
      <scope>test</scope>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>jp.co.yahoo.yosegi</groupId>
      <artifactId>yosegi</artifactId>
      <version>2.0.2</version>
    </dependency>
    <dependency>
      <groupId>jp.co.yahoo.yosegi</groupId>
      <artifactId>yosegi-legacy</artifactId>
      <version>2.0.1</version>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <version>5.3.2</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <version>5.3.2</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-params</artifactId>
      <version>5.3.2</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${maven-surefire-plugin.version}</version>
        <configuration>
          <useSystemClassLoader>false</useSystemClassLoader>
          <forkCount>2</forkCount>
          <reuseForks>true</reuseForks>
          <argLine>-Xmx1536m -XX:MaxPermSize=512m</argLine>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>5.3.2</version>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>3.1.1</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>test-jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.3</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </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>2.10.1</version>
        <configuration>
          <show>package</show>
          <source>1.8</source>
          <encoding>UTF-8</encoding>
          <docencoding>UTF-8</docencoding>
          <charset>UTF-8</charset>
          <links>
            <link>http://docs.oracle.com/javase/8/docs/api/</link>
          </links>
        </configuration>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.rat</groupId>
        <version>0.13</version>
        <artifactId>apache-rat-plugin</artifactId>
        <configuration>
          <excludes>
            <exclude>jars/**/*</exclude>
            <exclude>**/*.json</exclude>
            <exclude>**/*.txt</exclude>
            <exclude>**/*.template</exclude>
            <exclude>.gitignore</exclude>
            <exclude>.circleci/*</exclude>
            <exclude>.github/PULL_REQUEST_TEMPLATE.md</exclude>
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>3.0.0</version>
        <executions>
          <execution>
            <phase>test</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <configLocation>google_checks.xml</configLocation>
          <violationSeverity>warning</violationSeverity>
          <encoding>UTF-8</encoding>
          <consoleOutput>false</consoleOutput>
          <outputFile>${project.build.directory}/site/checkstyle/checkstyle-result.xml</outputFile>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>2.5.3</version>
        <configuration>
          <releaseProfiles>gpg-sign</releaseProfiles>
          <releaseVersion>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}_hive-${hive.version}</releaseVersion>
          <developmentVersion>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.nextIncrementalVersion}_hive-${hive.version}-SNAPSHOT</developmentVersion>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>3.2.0</version>
        <executions>
          <execution>
            <phase>validate</phase>
            <id>parse-version</id>
            <goals>
              <goal>parse-version</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>3.0.0</version>
        <executions>
          <execution>
            <phase>validate</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <echo>Major: ${parsedVersion.majorVersion}</echo>
                <echo>Minor: ${parsedVersion.minorVersion}</echo>
                <echo>Incremental: ${parsedVersion.incrementalVersion}</echo>
                <echo>Qualifier: ${parsedVersion.qualifier}</echo>
                <echo>BuildNumber: ${parsedVersion.buildNumber}</echo>
                <echo>nextIncremental: ${parsedVersion.nextIncrementalVersion}</echo>
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <repositories>
    <repository>
      <id>hdp</id>
      <url> http://repo.hortonworks.com/content/repositories/releases</url>
      <name>HDP</name>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
    <repository>
      <id>spring</id>
      <url>http://repo.spring.io/plugins-release/</url>
      <name>SPRING</name>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <version>2.7</version>
        <configuration>
          <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-maven-plugin</artifactId>
        <version>${spotbugs-maven-plugin.version}</version>
      </plugin>
    </plugins>
  </reporting>

  <profiles>
    <profile>
      <id>gpg-sign</id>
      <!--
      only sign during deploy phase
      -->
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.5</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
                <configuration>
                  <gpgArguments>
                    <arg>--pinentry-mode</arg>
                    <arg>loopback</arg>
                  </gpgArguments>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
      <properties>
        <gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
      </properties>
    </profile>
  </profiles>
</project>
