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

    <parent>
        <groupId>io.trino</groupId>
        <artifactId>trino-root</artifactId>
        <version>453-h0.cbu.mrs.360.r18</version>
        <relativePath>../../pom.xml</relativePath>
    </parent>

    <artifactId>trino-jdbc</artifactId>
    <description>Trino - JDBC driver</description>

    <properties>
        <air.main.basedir>${project.parent.basedir}</air.main.basedir>
        <project.build.targetJdk>8</project.build.targetJdk>
        <shadeBase>io.trino.jdbc.\$internal</shadeBase>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.google.errorprone</groupId>
            <artifactId>error_prone_annotations</artifactId>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>com.google.code.findbugs</groupId>
                    <artifactId>jsr305</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.google.errorprone</groupId>
                    <artifactId>error_prone_annotations</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.google.j2objc</groupId>
                    <artifactId>j2objc-annotations</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.checkerframework</groupId>
                    <artifactId>checker-qual</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>animal-sniffer-annotations</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.huawei.us</groupId>
            <artifactId>us-common</artifactId>
        </dependency>

        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>okhttp</artifactId>
        </dependency>

        <dependency>
            <groupId>io.airlift</groupId>
            <artifactId>log</artifactId>
            <version>0.193</version>
        </dependency>

        <dependency>
            <groupId>io.airlift</groupId>
            <artifactId>units</artifactId>
            <!-- JDK8 support dropped by version 1.8+ -->
            <version>1.7</version>
        </dependency>

        <dependency>
            <groupId>io.opentelemetry.instrumentation</groupId>
            <artifactId>opentelemetry-okhttp-3.0</artifactId>
        </dependency>

        <dependency>
            <groupId>io.trino</groupId>
            <artifactId>hetu-common</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>com.google.inject</groupId>
                    <artifactId>guice</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.airlift</groupId>
                    <artifactId>log</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.airlift</groupId>
                    <artifactId>security</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.trino</groupId>
                    <artifactId>trino-cache</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>io.trino</groupId>
            <artifactId>hetu-high-availability</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>ch.qos.reload4j</groupId>
                    <artifactId>reload4j</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.google.inject</groupId>
                    <artifactId>guice</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.airlift</groupId>
                    <artifactId>concurrent</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.airlift</groupId>
                    <artifactId>configuration</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.airlift</groupId>
                    <artifactId>discovery</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.airlift</groupId>
                    <artifactId>log</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.dropwizard.metrics</groupId>
                    <artifactId>metrics-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>jakarta.annotation</groupId>
                    <artifactId>jakarta.annotation-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.weakref</groupId>
                    <artifactId>jmxutils</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>io.trino</groupId>
            <artifactId>hetu-hsbroker-client</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>io.airlift</groupId>
                    <artifactId>log</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.bouncycastle</groupId>
                    <artifactId>bcprov-jdk18on</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>io.trino</groupId>
            <artifactId>trino-client</artifactId>
        </dependency>

        <dependency>
            <groupId>jakarta.annotation</groupId>
            <artifactId>jakarta.annotation-api</artifactId>
            <!-- JDK8 support dropped by version 3.0.0+ -->
            <version>2.1.1</version>
        </dependency>

        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.zookeeper</groupId>
            <artifactId>zookeeper</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.yetus</groupId>
                    <artifactId>audience-annotations</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcprov-jdk18on</artifactId>
        </dependency>

        <dependency>
            <groupId>org.weakref</groupId>
            <artifactId>jmxutils</artifactId>
            <version>1.21</version>
        </dependency>

        <dependency>
            <groupId>io.opentelemetry</groupId>
            <artifactId>opentelemetry-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.google.inject</groupId>
            <artifactId>guice</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.oracle.database.jdbc</groupId>
            <artifactId>ojdbc11</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>mockwebserver</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.airlift</groupId>
            <artifactId>concurrent</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.airlift</groupId>
            <artifactId>configuration</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.airlift</groupId>
            <artifactId>jaxrs</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.airlift</groupId>
            <artifactId>json</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.airlift</groupId>
            <artifactId>junit-extensions</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.airlift</groupId>
            <artifactId>log-manager</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.airlift</groupId>
            <artifactId>security</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.airlift</groupId>
            <artifactId>testing</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt-api</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt-impl</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.jsonwebtoken</groupId>
            <artifactId>jjwt-jackson</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.trino</groupId>
            <artifactId>trino-blackhole</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.trino</groupId>
            <artifactId>trino-hdfs</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.trino</groupId>
            <artifactId>trino-hive</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>io.trino</groupId>
            <artifactId>trino-main</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.trino</groupId>
            <artifactId>trino-memory</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.trino</groupId>
            <artifactId>trino-parser</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.trino</groupId>
            <artifactId>trino-password-authenticators</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.trino</groupId>
            <artifactId>trino-plugin-toolkit</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.trino</groupId>
            <artifactId>trino-spi</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.trino</groupId>
            <artifactId>trino-testing</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.trino</groupId>
            <artifactId>trino-testing-services</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.trino</groupId>
            <artifactId>trino-tpch</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>jakarta.ws.rs</groupId>
            <artifactId>jakarta.ws.rs-api</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>oracle-xe</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>postgresql</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>testcontainers</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <filtering>true</filtering>
                <directory>src/main/resources</directory>
                <includes>
                    <include>io/trino/jdbc/driver.properties</include>
                </includes>
            </resource>
            <resource>
                <filtering>false</filtering>
                <directory>src/main/resources</directory>
                <excludes>
                    <exclude>io/trino/jdbc/driver.properties</exclude>
                </excludes>
            </resource>
        </resources>

        <pluginManagement>
            <plugins>
                <!-- TODO: move this to Airbase -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <configuration>
                        <propertiesEncoding>ISO-8859-1</propertiesEncoding>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <configuration>
                        <rules>
                            <requireUpperBoundDeps>
                                <excludes combine.children="append">
                                    <exclude>io.airlift:units</exclude>
                                </excludes>
                            </requireUpperBoundDeps>
                        </rules>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <dependencies>
                    <!-- allow both JUnit and TestNG -->
                    <dependency>
                        <groupId>org.apache.maven.surefire</groupId>
                        <artifactId>surefire-junit-platform</artifactId>
                        <version>${dep.plugin.surefire.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.apache.maven.surefire</groupId>
                        <artifactId>surefire-testng</artifactId>
                        <version>${dep.plugin.surefire.version}</version>
                    </dependency>
                </dependencies>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <phase>package</phase>
                        <configuration>
                            <createSourcesJar>true</createSourcesJar>
                            <shadeSourcesContent>true</shadeSourcesContent>
                            <relocations>
                                <relocation>
                                    <pattern>io.trino.client</pattern>
                                    <shadedPattern>${shadeBase}.client</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>com.fasterxml.jackson</pattern>
                                    <shadedPattern>${shadeBase}.jackson</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>com.google.common</pattern>
                                    <shadedPattern>${shadeBase}.guava</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>com.google.thirdparty</pattern>
                                    <shadedPattern>${shadeBase}.guava</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>io.airlift</pattern>
                                    <shadedPattern>${shadeBase}.airlift</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>jakarta.annotation</pattern>
                                    <shadedPattern>${shadeBase}.jakarta.annotation</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>net.bytebuddy</pattern>
                                    <shadedPattern>${shadeBase}.net.bytebuddy</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>org.joda.time</pattern>
                                    <shadedPattern>${shadeBase}.joda.time</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>okhttp3</pattern>
                                    <shadedPattern>${shadeBase}.okhttp3</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>io.opentelemetry.extension</pattern>
                                    <shadedPattern>${shadeBase}.opentelemetry.extension</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>io.opentelemetry.instrumentation</pattern>
                                    <shadedPattern>${shadeBase}.opentelemetry.instrumentation</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>io.opentelemetry.api.incubator</pattern>
                                    <shadedPattern>${shadeBase}.opentelemetry.api.incubator</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>okio</pattern>
                                    <shadedPattern>${shadeBase}.okio</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>dev.failsafe</pattern>
                                    <shadedPattern>${shadeBase}.dev.failsafe</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>kotlin</pattern>
                                    <shadedPattern>${shadeBase}.kotlin</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>org.apache</pattern>
                                    <shadedPattern>${shadeBase}.org.apache</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>org.weakref.jmx</pattern>
                                    <shadedPattern>${shadeBase}.org.weakref.jmx</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>com.huawei</pattern>
                                    <shadedPattern>${shadeBase}.com.huawei</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>org.bouncycastle</pattern>
                                    <shadedPattern>${shadeBase}.org.bouncycastle</shadedPattern>
                                </relocation>
                            </relocations>
                            <filters>
                                <filter>
                                    <artifact>io.airlift:units</artifact>
                                    <excludes>
                                        <exclude>ValidationMessages.properties</exclude>
                                    </excludes>
                                </filter>
                                <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                        <exclude>org/jetbrains/**</exclude>
                                        <exclude>org/intellij/**</exclude>
                                        <exclude>com/google/errorprone/**</exclude>
                                        <exclude>META-INF/maven/**</exclude>
                                        <exclude>META-INF/licenses/**</exclude>
                                        <exclude>META-INF/services/com.fasterxml.**</exclude>
                                        <exclude>META-INF/proguard/**</exclude>
                                        <exclude>LICENSE</exclude>
                                        <exclude>META-INF/**.kotlin_module</exclude>
                                        <exclude>META-INF/versions/**</exclude>
                                        <exclude>META-INF/NOTICE**</exclude>
                                        <exclude>META-INF/*-NOTICE</exclude>
                                        <exclude>META-INF/*-LICENSE</exclude>
                                        <exclude>META-INF/LICENSE**</exclude>
                                        <exclude>META-INF/io/opentelemetry/**</exclude>
                                        <exclude>io/opentelemetry/semconv/**</exclude>
                                        <exclude>META-INF/native-image/**</exclude>
                                        <exclude>META-INF/kotlin-project-structure-metadata.json</exclude>
                                        <exclude>**/*.knm</exclude>
                                        <exclude>**/manifest</exclude>
                                        <exclude>**/module</exclude>
                                    </excludes>
                                </filter>
                                <filter>
                                    <artifact>org.bouncycastle:bcprov-jdk18on</artifact>
                                    <excludes>
                                        <exclude>META-INF/**</exclude>
                                    </excludes>
                                </filter>
                            </filters>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <configuration>
                    <ignoredUnusedDeclaredDependencies>
                        <dependency>com.huawei.us:us-common</dependency>
                        <dependency>org.bouncycastle:bcprov-jdk18on</dependency>
                        <dependency>org.apache.zookeeper:zookeeper</dependency>
                        <dependency>org.weakref:jmxutils</dependency>
                    </ignoredUnusedDeclaredDependencies>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>ci</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <configuration>
                            <systemPropertyVariables>
                                <jdbc-jar>${project.build.directory}/${project.name}-${project.version}.jar</jdbc-jar>
                            </systemPropertyVariables>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
