<?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>
  <groupId>ai.bleckwen</groupId>
  <artifactId>xgboost-predictor4j</artifactId>
  <packaging>jar</packaging>
  <version>1.2</version>
  <name>xgboost-predictor4j</name>
  <description>Bleckwen JVM implementation of XGBoost Predictor</description>
  <url>https://github.com/BleckwenAI/xgboost-predictor4j</url>
  <licenses>
    <license>
      <name>The Apache License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>
  <developers>
    <developer>
      <name>Harold.Braux</name>
      <email>harold.braux@bleckwen.ai</email>
    </developer>
  </developers>
  <scm>
    <developerConnection>scm:git:git@github.com:BleckwenAI/xgboost-predictor4j.git</developerConnection>
    <url>https://github.com/BleckwenAI/xgboost-predictor4j</url>
    <tag>xgboost-predictor4j-1.2</tag>
  </scm>


  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <scala.version>2.12.13</scala.version>
    <scala.major.version>2.12</scala.major.version>
    <scala.maven.plugin.version>4.4.0</scala.maven.plugin.version>
    <scalatest.version>3.0.8</scalatest.version>
    <scalatest-maven-plugin.version>2.0.0</scalatest-maven-plugin.version>
    <scala-plugin-scoverage.version>1.4.0</scala-plugin-scoverage.version>
    <scala-plugin-scapegoat.version>1.4.4</scala-plugin-scapegoat.version>
    <scoverage-plugin.version>1.4.0-RC1</scoverage-plugin.version>
    <maven.compiler.plugin.version>3.8.1</maven.compiler.plugin.version>
    <maven.surefire.plugin.version>3.0.0-M3</maven.surefire.plugin.version>
    <maven-release-plugin.version>2.5.2</maven-release-plugin.version>
    <maven-jar-plugin.version>2.6</maven-jar-plugin.version>
    <maven-assembly-plugin.version>3.2.0</maven-assembly-plugin.version>
    <xgboost4j.version>1.0.0</xgboost4j.version>
    <xgboost4j.scope>test</xgboost4j.scope>
    <jmh.version>1.21</jmh.version>
    <sonar-maven-plugin.version>3.7.0.1746</sonar-maven-plugin.version>
    <sonar.projectName>${project.artifactId}</sonar.projectName>
    <sonar.projectKey>ai.bleckwen.${project.artifactId}</sonar.projectKey>
    <sonar.moduleKey>${project.artifactId}</sonar.moduleKey>
    <sonar.scala.version>2.11</sonar.scala.version>
    <sonar.scala.scoverage.reportPath>target/scoverage.xml</sonar.scala.scoverage.reportPath>
    <sonar.scala.scapegoat.reportPath>target/scapegoat-report/scapegoat.xml
    </sonar.scala.scapegoat.reportPath>
    <sonar.dependencyCheck.reportPath>target/dependency-report/dependency-check-report.xml
    </sonar.dependencyCheck.reportPath>
    <sonar.dependencyCheck.htmlReportPath>target/dependency-report/dependency-check-report.html
    </sonar.dependencyCheck.htmlReportPath>
  </properties>


  <dependencies>
    <dependency>
      <groupId>org.scala-lang</groupId>
      <artifactId>scala-library</artifactId>
      <version>${scala.version}</version>
    </dependency>

    <dependency>
      <groupId>org.scalatest</groupId>
      <artifactId>scalatest_${scala.major.version}</artifactId>
      <version>${scalatest.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.openjdk.jmh</groupId>
      <artifactId>jmh-core</artifactId>
      <version>${jmh.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.openjdk.jmh</groupId>
      <artifactId>jmh-generator-annprocess</artifactId>
      <version>${jmh.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>2.7</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>ml.dmlc</groupId>
      <artifactId>xgboost4j_${scala.major.version}</artifactId>
      <version>${xgboost4j.version}</version>
      <scope>${xgboost4j.scope}</scope>
      <exclusions>
        <exclusion>
          <artifactId>scala-library</artifactId>
          <groupId>org.scala-lang</groupId>
        </exclusion>
      </exclusions>
    </dependency>

  </dependencies>
  <build>
    <sourceDirectory>${basedir}/src/main/scala</sourceDirectory>

    <plugins>
      <plugin>
        <groupId>net.alchim31.maven</groupId>
        <artifactId>scala-maven-plugin</artifactId>
        <version>${scala.maven.plugin.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
              <goal>testCompile</goal>
            </goals>
          </execution>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>doc-jar</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <scalaVersion>${scala.version}</scalaVersion>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.scoverage</groupId>
        <artifactId>scoverage-maven-plugin</artifactId>
        <version>${scoverage-plugin.version}</version>
        <configuration>
          <scalaVersion>${scala.version}</scalaVersion>
          <scalacPluginVersion>${scala-plugin-scoverage.version}</scalacPluginVersion>
          <highlighting>true</highlighting>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.scalatest</groupId>
        <artifactId>scalatest-maven-plugin</artifactId>
        <version>${scalatest-maven-plugin.version}</version>
        <configuration>
          <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
          <junitxml>.</junitxml>
          <filereports>WDF TestSuite.txt</filereports>
          <argLine>-Duser.country=US -Duser.language=en</argLine>
          <testOutputDirectory>${project.basedir}/target/test-classes</testOutputDirectory>
        </configuration>
        <executions>
          <execution>
            <id>test</id>
            <goals>
              <goal>test</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.owasp</groupId>
        <artifactId>dependency-check-maven</artifactId>
        <version>5.2.4</version>
        <configuration>
          <format>ALL</format>
          <outputDirectory>${project.build.directory}/dependency-report</outputDirectory>
          <skipSystemScope>true</skipSystemScope>
        </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.9.1</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>
            <configuration>
                <gpgArguments>
                    <arg>--pinentry-mode</arg>
                    <arg>loopback</arg>
                </gpgArguments>
            </configuration>
          </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>true</autoReleaseAfterClose>
        </configuration>
      </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>release</releaseProfiles>
          <goals>deploy</goals>
        </configuration>
      </plugin>


      <!--DISABLED PLUGINS-->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${maven.compiler.plugin.version}</version>
        <executions>
          <execution>
            <id>default-compile</id>
            <phase>none</phase>
          </execution>
          <execution>
            <id>default-testCompile</id>
            <phase>none</phase>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${maven.surefire.plugin.version}</version>
        <executions>
          <execution>
            <id>default-test</id>
            <phase>none</phase>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <version>3.0.0</version>
        <reportSets>
          <reportSet>
            <reports>
              <report>index</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>

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

  <profiles>
    <!-- DEFAULT PROFILE-->
    <profile>
      <id>default</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
    </profile>

    <!-- BUILD WITH Scala 2.13 -->
    <profile>
      <id>scala213</id>
      <properties>
        <scala.major.version>2.13</scala.major.version>
        <scala.version>2.13.6</scala.version>
      </properties>
      <build>
        <finalName>${project.artifactId}_${scala.major.version}</finalName>
      </build>
    </profile>

    <!-- SCAPEGOAT CHECKS -->
    <profile>
      <id>scapegoat</id>
      <build>
        <plugins>
          <plugin>
            <groupId>net.alchim31.maven</groupId>
            <artifactId>scala-maven-plugin</artifactId>
            <version>${scala.maven.plugin.version}</version>
            <executions>
              <execution>
                <id>scala-compile</id>
                <goals>
                  <goal>compile</goal>
                  <goal>add-source</goal>
                </goals>
              </execution>
              <execution>
                <id>scala-testCompile</id>
                <phase>none</phase>
                <goals>
                  <goal>testCompile</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <scalaVersion>${scala.version}</scalaVersion>
              <args>
                <arg>-P:scapegoat:dataDir:${project.basedir}/target/scapegoat-report</arg>
              </args>
              <compilerPlugins>
                <compilerPlugin>
                  <groupId>com.sksamuel.scapegoat</groupId>
                  <artifactId>scalac-scapegoat-plugin_${scala.version}</artifactId>
                  <version>${scala-plugin-scapegoat.version}</version>
                </compilerPlugin>
              </compilerPlugins>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- BUILD FOR JMH -->
    <profile>
      <id>jmh</id>
      <properties>
        <xgboost4j.scope>compile</xgboost4j.scope>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>1.7</version>
            <executions>
              <execution>
                <id>add-source</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>add-test-source</goal>
                </goals>
                <configuration>
                  <sources>
                    <source>${project.basedir}/target/generated-sources/java</source>
                  </sources>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>net.alchim31.maven</groupId>
            <artifactId>scala-maven-plugin</artifactId>
            <version>${scala.maven.plugin.version}</version>
            <executions>
              <execution>
                <id>default</id>
                <goals>
                  <goal>compile</goal>
                </goals>
              </execution>
              <execution>
                <id>testCompile</id>
                <phase>process-test-sources</phase>
                <goals>
                  <goal>testCompile</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <testSourceDir>${project.basedir}/src/bench/scala</testSourceDir>
            </configuration>
          </plugin>

          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.6.0</version>
            <executions>
              <execution>
                <phase>process-test-sources</phase>
                <goals>
                  <goal>java</goal>
                </goals>
                <configuration>
                  <includePluginDependencies>true</includePluginDependencies>
                  <mainClass>org.openjdk.jmh.generators.bytecode.JmhBytecodeGenerator</mainClass>
                  <arguments>
                    <argument>${project.basedir}/target/test-classes/</argument>
                    <argument>${project.basedir}/target/generated-sources/java</argument>
                    <argument>${project.basedir}/target/test-classes/</argument>
                    <argument>default</argument>
                  </arguments>
                </configuration>
              </execution>
            </executions>
            <dependencies>
              <dependency>
                <groupId>org.openjdk.jmh</groupId>
                <artifactId>jmh-generator-bytecode</artifactId>
                <version>${jmh.version}</version>
              </dependency>
            </dependencies>
          </plugin>

          <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>${maven-assembly-plugin.version}</version>
            <configuration>
              <descriptors>
                <descriptor>src/test/assembly.xml</descriptor>
              </descriptors>
            </configuration>
            <executions>
              <execution>
                <id>make-assembly</id>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
                <configuration>
                  <archive>
                    <manifest>
                      <mainClass>org.openjdk.jmh.Main</mainClass>
                    </manifest>
                  </archive>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

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

</project>
