<?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>com.databricks</groupId>
  <artifactId>databricks-jdbc</artifactId>
  <!-- This value may be modified by a release script to reflect the current version of the driver. -->
  <version>0.9.5-oss</version>
  <packaging>jar</packaging>
  <name>Databricks JDBC Driver</name>
  <description>Databricks JDBC Driver.</description>
  <url>https://github.com/databricks/databricks-jdbc</url>
  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>https://github.com/databricks/databricks-jdbc/blob/main/LICENSE</url>
    </license>
  </licenses>
  <developers>
    <developer>
      <name>Databricks JDBC Team</name>
      <email>eng-oss-sql-driver@databricks.com</email>
      <organization>Databricks</organization>
      <organizationUrl>https://www.databricks.com</organizationUrl>
    </developer>
  </developers>
  <scm>
      <connection>scm:git:https://github.com/databricks/databricks-jdbc.git</connection>
      <developerConnection>scm:git:https://github.com/databricks/databricks-jdbc.git</developerConnection>
      <url>https://github.com/databricks/databricks-jdbc</url>
  </scm>
  <issueManagement>
    <system>GitHub Issues</system>
    <url>https://github.com/databricks/databricks-jdbc/issues</url>
  </issueManagement>
  <distributionManagement>
    <repository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
  </distributionManagement>
  <properties>
    <arrow.version>13.0.0</arrow.version>
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
    <mockito.version>5.2.0</mockito.version>
    <jackson.version>2.15.1</jackson.version>
    <log4j.version>2.22.1</log4j.version>
    <slf4j.version>2.0.13</slf4j.version>
    <google.guava.version>33.0.0-jre</google.guava.version>
    <junit.jupiter.version>5.9.2</junit.jupiter.version>
    <google.findbugs.annotations.version>3.0.1</google.findbugs.annotations.version>
    <immutables.value.version>2.9.2</immutables.value.version>
    <httpclient.version>4.5.14</httpclient.version>
    <commons-io.version>2.13.0</commons-io.version>
    <databricks-sdk.version>0.31.1</databricks-sdk.version>
    <maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version>
    <sql-logic-test.version>0.3</sql-logic-test.version>
    <lz4-compression.version>1.8.0</lz4-compression.version>
    <thrift.version>0.19.0</thrift.version>
    <annotation.version>1.3.5</annotation.version>
    <slt.executor>dbsql</slt.executor>
    <slt.token>dummy-token</slt.token>
    <wiremock.version>3.5.4</wiremock.version>
    <nimbusjose.version>9.40</nimbusjose.version>
    <bouncycastle.version>1.78.1</bouncycastle.version>
  </properties>
  <dependencies>
    <dependency>
      <groupId>com.databricks</groupId>
      <artifactId>databricks-sdk-java</artifactId>
      <version>${databricks-sdk.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.arrow</groupId>
      <artifactId>arrow-memory-core</artifactId>
      <version>${arrow.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.arrow</groupId>
      <artifactId>arrow-memory-unsafe</artifactId>
      <version>${arrow.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.arrow</groupId>
      <artifactId>arrow-vector</artifactId>
      <version>${arrow.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.arrow</groupId>
      <artifactId>arrow-memory-netty</artifactId>
      <version>${arrow.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpclient</artifactId>
      <version>${httpclient.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.thrift</groupId>
      <artifactId>libthrift</artifactId>
      <version>${thrift.version}</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${slf4j.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-slf4j2-impl</artifactId>
      <version>${log4j.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-core</artifactId>
      <version>${log4j.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-api</artifactId>
      <version>${log4j.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>${commons-io.version}</version>
    </dependency>
    <dependency>
      <groupId>com.google.code.findbugs</groupId>
      <artifactId>annotations</artifactId>
      <version>${google.findbugs.annotations.version}</version>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>${google.guava.version}</version>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <version>${junit.jupiter.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.nimbusds</groupId>
      <artifactId>nimbus-jose-jwt</artifactId>
      <version>${nimbusjose.version}</version>
    </dependency>
    <dependency>
      <groupId>org.bouncycastle</groupId>
      <artifactId>bcprov-jdk18on</artifactId>
      <version>${bouncycastle.version}</version>
    </dependency>
    <dependency>
      <groupId>org.bouncycastle</groupId>
      <artifactId>bcpkix-jdk18on</artifactId>
      <version>${bouncycastle.version}</version>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-inline</artifactId>
      <version>${mockito.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-junit-jupiter</artifactId>
      <version>${mockito.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>${jackson.version}</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-annotations</artifactId>
      <version>${jackson.version}</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-core</artifactId>
      <version>${jackson.version}</version>
    </dependency>
    <dependency>
      <groupId>org.immutables</groupId>
      <artifactId>value</artifactId>
      <version>${immutables.value.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>net.hydromatic</groupId>
      <artifactId>sql-logic-test</artifactId>
      <version>${sql-logic-test.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.lz4</groupId>
      <artifactId>lz4-java</artifactId>
      <version>${lz4-compression.version}</version>
    </dependency>
    <dependency>
      <groupId>jakarta.annotation</groupId>
      <artifactId>jakarta.annotation-api</artifactId>
      <version>${annotation.version}</version>
    </dependency>
    <dependency>
      <groupId>org.wiremock</groupId>
      <artifactId>wiremock</artifactId>
      <version>${wiremock.version}</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>commons-fileupload</groupId>
          <artifactId>commons-fileupload</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>

  <build>
    <finalName>${project.artifactId}-${project.version}</finalName>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>3.3.0</version>
        <configuration>
          <archive>
            <manifest>
              <mainClass>com.databricks.client.jdbc.Driver</mainClass>
              <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
            </manifest>
          </archive>
        </configuration>
        <executions>
          <execution>
            <id>default-jar</id>
            <phase>package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
          <execution>
            <goals>
              <goal>test-jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${maven-surefire-plugin.version}</version>
        <configuration>
          <excludes>
            <exclude>**/DriverTest.java</exclude>
            <exclude>**/integration/**/*.java</exclude>
          </excludes>
          <argLine>
            @{argLine}
            --add-opens=java.base/java.nio=ALL-UNNAMED
            -Dnet.bytebuddy.experimental=true
          </argLine>
          <systemPropertyVariables>
            <com.databricks.jdbc.loggerImpl>JDKLOGGER</com.databricks.jdbc.loggerImpl>
            <java.util.logging.config.file>${project.basedir}/src/test/resources/logging.properties</java.util.logging.config.file>
          </systemPropertyVariables>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.2.1</version>
        <configuration>
          <executable>java</executable>
          <arguments>
            <argument>--add-opens=java.base/java.nio=ALL-UNNAMED</argument>
            <argument>-classpath</argument>
            <classpath />
            <argument>com.databricks.jdbc.sqllogictest.SLTMain</argument>
            <argument>-e</argument>
            <argument>${slt.executor}</argument>
            <argument>-p</argument>
            <argument>${slt.token}</argument>
          </arguments>
          <classpathScope>test</classpathScope>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <annotationProcessorPaths>
            <path>
              <groupId>org.immutables</groupId>
              <artifactId>value</artifactId>
              <version>${immutables.value.version}</version>
            </path>
          </annotationProcessorPaths>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.diffplug.spotless</groupId>
        <artifactId>spotless-maven-plugin</artifactId>
        <version>2.39.0</version>
        <executions>
          <execution>
            <id>format</id>
            <goals>
              <goal>apply</goal>
            </goals>
            <phase>compile</phase>
          </execution>
        </executions>
        <configuration>
          <java>
            <googleJavaFormat>
              <version>1.18.1</version>
            </googleJavaFormat>
          </java>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.8.11</version>
        <executions>
          <execution>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>report</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <excludes>
            <exclude>**/*Constants*</exclude>
            <exclude>**/*Exception*</exclude>
            <exclude>**/CommandName*</exclude>
            <exclude>**/DatabricksJdbcConstants*</exclude>
            <exclude>**/DatabricksJdbcUrlParams*</exclude>
            <exclude>**/Driver*</exclude>
            <exclude>**/EnvironmentVariables*</exclude>
            <exclude>**/model/**</exclude>
            <exclude>**/thrift/generated/**</exclude>
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>3.5.0</version>
        <dependencies>
          <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-transform-maven-shade-plugin-extensions</artifactId>
            <version>0.1.0</version>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <id>shade and package jars</id>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <createDependencyReducedPom>false</createDependencyReducedPom>
              <shadedArtifactAttached>true</shadedArtifactAttached>
              <shadedClassifierName>UBER</shadedClassifierName>
              <relocations>
                <relocation>
                  <pattern>codegen</pattern>
                  <shadedPattern>com.databricks.internal.codegen</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>com.databricks.sdk</pattern>
                  <shadedPattern>com.databricks.internal.sdk</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>com.fasterxml</pattern>
                  <shadedPattern>com.databricks.internal.fasterxml</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>com.google</pattern>
                  <shadedPattern>com.databricks.internal.google</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>com.nimbusds</pattern>
                  <shadedPattern>com.databricks.internal.nimbusds</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>io</pattern>
                  <shadedPattern>com.databricks.internal.io</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>jakarta.servlet</pattern>
                  <shadedPattern>com.databricks.internal.jakarta.servlet</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>net.jpountz</pattern>
                  <shadedPattern>com.databricks.internal.jpountz</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>org.apache</pattern>
                  <shadedPattern>com.databricks.internal.apache</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>org.bouncycastle</pattern>
                  <shadedPattern>com.databricks.internal.bouncycastle</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>org.checkerframework</pattern>
                  <shadedPattern>com.databricks.internal.checkerframework</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>org.ini4j</pattern>
                  <shadedPattern>com.databricks.internal.ini4j</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>org.json</pattern>
                  <shadedPattern>com.databricks.internal.json</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>org.osgi</pattern>
                  <shadedPattern>com.databricks.internal.osgi</shadedPattern>
                </relocation>
              </relocations>
              <filters>
                <filter>
                  <artifact>*:*</artifact>
                  <excludes>
                    <exclude>META-INF/*.DSA</exclude>
                    <exclude>META-INF/*.RSA</exclude>
                    <exclude>META-INF/*.SF</exclude>
                    <exclude>META-INF/DEPENDENCIES</exclude>
                    <exclude>META-INF/LICENSE.txt</exclude>
                    <exclude>META-INF/versions/**</exclude>
                  </excludes>
                </filter>
                <filter>
                  <artifact>*:*</artifact>
                  <excludes>
                    <exclude>edu/**</exclude>
                    <exclude>javax/**</exclude>
                    <exclude>net/jcip/**</exclude>
                    <exclude>oauth/**</exclude>
                  </excludes>
                </filter>
              </filters>
              <transformers>
                <transformer implementation="org.apache.logging.log4j.maven.plugins.shade.transformer.Log4j2PluginCacheFileTransformer"/>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <mainClass>com.databricks.client.jdbc.Driver</mainClass>
                  <manifestEntries>
                    <Implementation-Title>${project.artifactId}</Implementation-Title>
                    <Implementation-Version>${project.version}</Implementation-Version>
                  </manifestEntries>
                </transformer>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
              </transformers>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>3.3.0</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>3.6.0</version>
            <configuration>
              <doclint>none</doclint>
              <sourcepath>${project.build.sourceDirectory}:${project.build.directory}/generated-sources/annotations</sourcepath>
            </configuration>
            <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.6</version>
            <configuration>
              <!-- Prevent gpg from using pinentry programs -->
              <gpgArguments>
                <arg>--pinentry-mode</arg>
                <arg>loopback</arg>
              </gpgArguments>
            </configuration>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <goals>
                  <goal>sign</goal>
                </goals>
                <phase>verify</phase>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>1.6.13</version>
            <extensions>true</extensions>
            <configuration>
              <serverId>ossrh</serverId>
              <nexusUrl>https://oss.sonatype.org/</nexusUrl>
              <autoReleaseAfterClose>true</autoReleaseAfterClose>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
