<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.databricks.labs</groupId>
    <artifactId>automl-toolkit</artifactId>
    <packaging>jar</packaging>
    <version>0.8.1</version>
    <properties>
        <scala.version>2.12.10</scala.version>
        <spark.version>3.0.1</spark.version>
        <mlflow.version>1.11.0</mlflow.version>
        <json4s.version>3.6.6</json4s.version>
        <dependency.scope>provided</dependency.scope>
        <dmlc.version>1.0.0</dmlc.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>${scala.version}</version>
            <scope>${dependency.scope}</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-core_2.12</artifactId>
            <version>${spark.version}</version>
            <scope>${dependency.scope}</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-sql_2.12</artifactId>
            <version>${spark.version}</version>
            <scope>${dependency.scope}</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-mllib_2.12</artifactId>
            <version>${spark.version}</version>
            <scope>${dependency.scope}</scope>
        </dependency>
        <dependency>
            <groupId>org.mlflow</groupId>
            <artifactId>mlflow-client</artifactId>
            <version>${mlflow.version}</version>
            <scope>${dependency.scope}</scope>
        </dependency>
        <dependency>
            <groupId>org.json4s</groupId>
            <artifactId>json4s-jackson_2.12</artifactId>
            <version>${json4s.version}</version>
            <scope>${dependency.scope}</scope>
        </dependency>
        <dependency>
            <groupId>ml.dmlc</groupId>
            <artifactId>xgboost4j_2.12</artifactId>
            <version>${dmlc.version}</version>
            <scope>${dependency.scope}</scope>
        </dependency>
        <dependency>
            <groupId>ml.dmlc</groupId>
            <artifactId>xgboost4j-spark_2.12</artifactId>
            <version>${dmlc.version}</version>
            <scope>${dependency.scope}</scope>
        </dependency>
        <dependency>
            <groupId>org.joda</groupId>
            <artifactId>joda-convert</artifactId>
            <version>1.7</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
            <version>2.10.5</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.scalatest</groupId>
            <artifactId>scalatest_2.12</artifactId>
            <version>3.0.8</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.databricks</groupId>
            <artifactId>dbutils-api_2.12</artifactId>
            <version>0.0.5</version>
            <scope>${dependency.scope}</scope>
        </dependency>
        <dependency>
            <groupId>ml.combust.mleap</groupId>
            <artifactId>mleap-runtime_2.12</artifactId>
            <version>0.16.0</version>
        </dependency>
        <dependency>
            <groupId>ml.combust.mleap</groupId>
            <artifactId>mleap-spark_2.12</artifactId>
            <version>0.16.0</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
                <version>4.4.0</version>
                <executions>
                    <execution>
                        <id>scala-compile-first</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>scala-test-compile-first</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>attach-scaladocs</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>doc-jar</goal>
                        </goals>
                    </execution>
                    <execution>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <excludes>
                        <exclude>com/databricks/labs/automl/ensemble/tuner/impl/GbmTunerDelegator.scala</exclude>
                        <exclude>com/databricks/labs/automl/model/LightGBMTuner.scala</exclude>
                        <exclude>com/databricks/labs/automl/exploration/visualizations/OneDimVisualizations.scala</exclude>
                        <exclude>com/databricks/labs/automl/exploration/visualizations/OneDimVisualizationsTest.scala</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M3</version>
                <configuration>
                    <forkCount>8</forkCount>
                    <reuseForks>true</reuseForks>
                    <argLine>-Xmx2048m -XX:MaxPermSize=256m</argLine>
                    <excludes>
                        <exclude>**/*TunerTest.scala</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.1.1</version>
                <executions>
                    <execution>
                        <id>copy</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <artifactItems>
                        <artifactItem>
                            <groupId>com.databricks.labs</groupId>
                            <artifactId>${project.artifactId}</artifactId>
                            <version>${project.version}</version>
                            <type>jar</type>
                            <overWrite>true</overWrite>
                            <outputDirectory>${project.basedir}/bin</outputDirectory>
                        </artifactItem>
                    </artifactItems>
                    <excludes>
                        **\/CommandContext.class
                    </excludes>
                    <outputDirectory>${project.basedir}/bin</outputDirectory>
                    <overWriteReleases>true</overWriteReleases>
                    <overWriteSnapshots>true</overWriteSnapshots>
                </configuration>
            </plugin>
            <!-- Below plugins needed to sign artifacts to publish to maven central  -->
            <plugin>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>2.8.2</version>
                <executions>
                    <execution>
                        <id>default-deploy</id>
                        <phase>deploy</phase>
                        <goals>
                            <goal>deploy</goal>
                        </goals>
                    </execution>
                </executions>
            </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>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>gpg-sign-deploy</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <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>
                            <!-- Set this to true and the release will automatically proceed and sync to Central Repository will follow  -->
                            <autoReleaseAfterClose>false</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>uber-shaded-jar</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-shade-plugin</artifactId>
                        <version>1.7.1</version>
                        <configuration>
                            <filters>
                                <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                        <exclude>META-INF/*.SF</exclude>
                                        <exclude>META-INF/*.DSA</exclude>
                                        <exclude>META-INF/*.RSA</exclude>
                                    </excludes>
                                </filter>
                            </filters>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>shade</goal>
                                </goals>
                                <configuration>
                                    <relocations>
                                        <relocation>
                                            <pattern>org.json4s</pattern>
                                            <shadedPattern>shadeio.@1</shadedPattern>
                                        </relocation>
                                    </relocations>
                                    <filters>
                                        <filter>
                                            <artifact>${project.groupId}:${project.artifactId}</artifact>
                                            <incldues>
                                                <include></include>
                                            </incldues>
                                            <excludes>
                                                <exclude>com/databricks/backend/common/rpc/**</exclude>
                                                <exclude>org.apache.spark:*</exclude>
                                            </excludes>
                                        </filter>
                                    </filters>
                                    <transformers>
                                        <transformer
                                                implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                                        <!-- Some care is required: http://doc.akka.io/docs/akka/snapshot/general/configuration.html -->
                                        <transformer
                                                implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                            <resource>reference.conf</resource>
                                        </transformer>
                                    </transformers>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>



    <!-- All below tags are needed for pushing to maven central  -->
    <name>${project.groupId}:${project.artifactId}</name>
    <description>Databricks Labs AutoML Toolkit</description>
    <url>https://github.com/databrickslabs/automl-toolkit</url>

    <organization>
        <name>com.databricks.labs</name>
        <url>https://github.com/databrickslabs/automl-toolkit</url>
    </organization>

    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/databrickslabs/automl-toolkit/issues</url>
    </issueManagement>
    <licenses>
        <license>
            <name>Databricks Labs</name>
            <url>https://github.com/databrickslabs/automl-toolkit/blob/master/LICENSE.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <scm>
        <url>https://github.com/databrickslabs/automl-toolkit</url>
        <connection>
            scm:git:git://github.com/databrickslabs/automl-toolkit.git
        </connection>
        <developerConnection>
            scm:git:ssh://git@github.com:databrickslabs/automl-toolkit.git
        </developerConnection>
    </scm>
    <developers>
        <developer>
            <id>benwilson</id>
            <name>Ben Wilson</name>
        </developer>
        <developer>
            <id>jasbali</id>
            <name>Jas Bali</name>
        </developer>
        <developer>
            <id>marygracemoesta</id>
            <name>Mary Grace Moesta</name>
        </developer>
        <developer>
            <id>danieltomes</id>
            <name>Daniel Tomes</name>
        </developer>
        <developer>
            <id>nicksenno</id>
            <name>Nick Senno</name>
        </developer>
    </developers>

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