<?xml version="1.0" encoding="UTF-8"?>
<!--
 Licensed to Diennea S.r.l. under one
 or more contributor license agreements. See the NOTICE file
 distributed with this work for additional information
 regarding copyright ownership. Diennea S.r.l. 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>
        <groupId>org.herddb</groupId>
        <artifactId>herddb-parent</artifactId>
        <version>0.26.0</version>
        <relativePath>..</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <name>HerdDB JDBC Driver</name>
    <artifactId>herddb-jdbc</artifactId>
    <packaging>jar</packaging>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>herddb-core</artifactId>
            <version>${project.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.bookkeeper.stats</groupId>
                    <artifactId>prometheus-metrics-provider</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.yetus</groupId>
                    <artifactId>audience-annotations</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-pool2</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-jdk14</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.curator</groupId>
            <artifactId>curator-test</artifactId>           
            <scope>test</scope>
        </dependency>
        <dependency>
            <!-- needed for ZK server -->
            <groupId>io.dropwizard.metrics</groupId>
            <artifactId>metrics-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <!-- needed for ZK server -->
            <groupId>org.xerial.snappy</groupId>
            <artifactId>snappy-java</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                    <execution>
                        <id>make-uber</id>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <shadedArtifactAttached>true</shadedArtifactAttached>
                            <shadedClassifierName>uber</shadedClassifierName>
                            <artifactSet>
                                <excludes>
                                    <exclude>jline:jline</exclude>
                                </excludes>
                            </artifactSet>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <manifestEntries>
                                        <Multi-Release>true</Multi-Release>
                                    </manifestEntries>
                                </transformer>
                            </transformers>
                            <filters>
                                <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                        <exclude>META-INF/*.SF</exclude>
                                        <exclude>META-INF/*.DSA</exclude>
                                        <exclude>META-INF/*.RSA</exclude>
                                    </excludes>
                                </filter>
                            </filters>
                        </configuration>
                    </execution>
                    <execution>
                        <id>make-embedded</id>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <shadedArtifactAttached>true</shadedArtifactAttached>
                            <shadedClassifierName>embedded</shadedClassifierName>
                            <artifactSet>
                                <excludes>
                                    <exclude>jline:jline</exclude>
                                </excludes>
                            </artifactSet>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <manifestEntries>
                                        <Multi-Release>true</Multi-Release>
                                    </manifestEntries>
                                </transformer>
                            </transformers>
                            <filters>
                                <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                        <exclude>META-INF/*.SF</exclude>
                                        <exclude>META-INF/*.DSA</exclude>
                                        <exclude>META-INF/*.RSA</exclude>
                                    </excludes>
                                </filter>
                            </filters>
                        </configuration>
                    </execution>
                    <execution>
                        <id>make-thin</id>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <shadedArtifactAttached>true</shadedArtifactAttached>
                            <shadedClassifierName>thin</shadedClassifierName>
                            <createDependencyReducedPom>true</createDependencyReducedPom>
                            <dependencyReducedPomLocation>${basedir}/thin-dependency-reduced-pom.xml</dependencyReducedPomLocation>
                            <artifactSet>
                                <excludes>
                                    <exclude>jline:jline</exclude>
                                    <exclude>com.google.protobuf:*</exclude>
                                    <exclude>org.apache.bookkeeper:*</exclude>
                                    <exclude>org.apache.zookeeper:*</exclude>
                                    <exclude>commons-configuration:*</exclude>
                                    <exclude>org.bouncycastle:*</exclude>
                                    <exclude>net.java.dev.jna:*</exclude>
                                    <exclude>org.apache.httpcomponents</exclude>
                                    <exclude>org.jctools:*</exclude>
                                    <exclude>net.jpountz.lz4:*</exclude>
                                    <exclude>io.netty:netty-transport-native-unix-common:*</exclude>
                                    <exclude>io.netty:netty-transport-native-epoll:*</exclude>
                                    <exclude>io.netty:netty-tcnative-boringssl-static:*</exclude>
                                    <exclude>org.apache.commons:commons-pool2:*</exclude>
                                </excludes>
                            </artifactSet>
                            <relocations>
                                <relocation>
                                    <pattern>org.apache</pattern>
                                    <shadedPattern>herddb.org.apache</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>io.netty</pattern>
                                    <shadedPattern>herddb.io.netty</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>com.esri</pattern>
                                    <shadedPattern>herddb.com.esri</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>com.jayway</pattern>
                                    <shadedPattern>herddb.com.jayway</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>com.fasterxml</pattern>
                                    <shadedPattern>herddb.com.fasterxml</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>com.google</pattern>
                                    <shadedPattern>herddb.com.google</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>org.slf4j</pattern>
                                    <shadedPattern>herddb.org.slf4j</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>net.jcp</pattern>
                                    <shadedPattern>herddb.net.jcp</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>net.sf.jsqlparser</pattern>
                                    <shadedPattern>herddb.net.sf.jsqlparser</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>net.jpountz</pattern>
                                    <shadedPattern>herddb.net.jpountz</shadedPattern>
                                </relocation>
                                <relocation>
                                    <!-- Calcite stuff -->
                                    <pattern>com.jayway.jsonpath</pattern>
                                    <shadedPattern>herddb.com.jayway.jsonpath</shadedPattern>
                                </relocation>

                                <!-- Cannot relocate org.codehaus.commons.compiler stuff, needed by Calcite
                                    <relocation>
                                    <pattern>org.codehaus</pattern>
                                    <shadedPattern>herddb.org.codehaus</shadedPattern>
                                </relocation> -->
                            </relocations>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <manifestEntries>
                                        <Multi-Release>true</Multi-Release>
                                    </manifestEntries>
                                </transformer>
                            </transformers>
                            <filters>
                                <filter>
                                    <artifact>com.google.guava:guava</artifact>
                                    <includes>
                                        <include>com/google/common/collect/**</include>
                                        <include>com/google/common/util/concurrent/**</include>
                                        <include>com/google/common/cache/**</include>
                                        <include>com/google/common/base/**</include>
                                        <include>com/google/common/primitives/**</include> <!-- Calcite -->
                                       <include>com/google/common/math/**</include> <!-- Calcite -->
                                    </includes>
                                </filter>
                                <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                        <exclude>META-INF/*.SF</exclude>
                                        <exclude>META-INF/*.DSA</exclude>
                                        <exclude>META-INF/*.RSA</exclude>
                                    </excludes>
                                </filter>
                            </filters>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
