<?xml version="1.0" encoding="UTF-8"?>
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
    license agreements. See the NOTICE file distributed with this work for additional
    information regarding copyright ownership. The ASF licenses this file to
    You 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. -->

<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">
    <parent>
        <artifactId>arrow-flight</artifactId>
        <groupId>org.apache.arrow</groupId>
        <version>15.0.2</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>flight-sql-jdbc-driver</artifactId>
    <name>Arrow Flight SQL JDBC Driver</name>
    <description>A JDBC driver based on Arrow Flight SQL.</description>
    <packaging>jar</packaging>
    <url>https://arrow.apache.org</url>

    <dependencies>
        <!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest-core -->
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-core</artifactId>
            <version>1.3</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.arrow</groupId>
            <artifactId>flight-sql-jdbc-core</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcpkix-jdk15on</artifactId>
            <version>1.61</version>
            <scope>runtime</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.arrow/arrow-memory-core -->
        <dependency>
            <groupId>org.apache.arrow</groupId>
            <artifactId>arrow-memory-core</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.arrow</groupId>
            <artifactId>flight-sql</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>${mockito.core.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-inline</artifactId>
            <version>${mockito.inline.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.arrow</groupId>
            <artifactId>flight-core</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>io.netty</groupId>
                    <artifactId>netty-transport-native-kqueue</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>io.netty</groupId>
                    <artifactId>netty-transport-native-epoll</artifactId>
                </exclusion>
            </exclusions>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-common</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
            <version>2.12.5</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.calcite.avatica</groupId>
            <artifactId>avatica</artifactId>
            <version>1.24.0</version>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>com.google.protobuf</groupId>
            <artifactId>protobuf-java</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.arrow</groupId>
            <artifactId>arrow-vector</artifactId>
            <classifier>${arrow.vector.classifier}</classifier>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.7</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <enableAssertions>false</enableAssertions>
                    <systemPropertyVariables>
                        <arrow.test.dataRoot>${project.basedir}/../../../testing/data</arrow.test.dataRoot>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <shadedArtifactAttached>false</shadedArtifactAttached>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                            <minimizeJar>false</minimizeJar>
                            <artifactSet>
                                <includes>
                                    <include>*:*</include>
                                </includes>
                            </artifactSet>
                            <relocations>
                                <relocation>
                                    <pattern>com.</pattern>
                                    <shadedPattern>cfjd.com.</shadedPattern>
                                    <excludes>
                                        <exclude>com.sun.**</exclude>
                                    </excludes>
                                </relocation>
                                <relocation>
                                    <pattern>org.</pattern>
                                    <shadedPattern>cfjd.org.</shadedPattern>
                                    <excludes>
                                        <exclude>org.apache.arrow.driver.jdbc.**</exclude>
                                        <exclude>org.slf4j.**</exclude>
                                        <!-- Avoid shading Flight JDBC Properties -->
                                        <exclude>org.apache.arrow.flight.name</exclude>
                                        <exclude>org.apache.arrow.flight.version</exclude>
                                        <exclude>org.apache.arrow.flight.jdbc-driver.name</exclude>
                                        <exclude>org.apache.arrow.flight.jdbc-driver.version</exclude>
                                    </excludes>
                                </relocation>
                                <relocation>
                                    <pattern>io.</pattern>
                                    <shadedPattern>cfjd.io.</shadedPattern>
                                </relocation>
                                <!-- Entries to relocate netty native libraries  -->
                                <relocation>
                                    <pattern>META-INF.native.libnetty_</pattern>
                                    <shadedPattern>META-INF.native.libcfjd_netty_</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>META-INF.native.netty_</pattern>
                                    <shadedPattern>META-INF.native.cfjd_netty_</shadedPattern>
                                </relocation>
                            </relocations>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                            </transformers>
                            <filters>
                                <filter>
                                    <artifact>org.apache.calcite.avatica:*</artifact>
                                    <excludes>
                                        <exclude>META-INF/services/java.sql.Driver</exclude>
                                    </excludes>
                                </filter>
                                <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                        <exclude>**/*.SF</exclude>
                                        <exclude>**/*.RSA</exclude>
                                        <exclude>**/*.DSA</exclude>
                                        <exclude>META-INF/native/libio_grpc_netty*</exclude>
                                        <exclude>META-INF/native/io_grpc_netty_shaded*</exclude>
                                    </excludes>
                                </filter>
                            </filters>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
