<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         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.singlestore</groupId>
    <artifactId>singlestore-jdbc-client</artifactId>
    <packaging>jar</packaging>
    <name>singlestore-jdbc-client</name>
    <version>1.2.5</version>
    <description>SingleStore JDBC Driver</description>
    <url>https://github.com/memsql/S2-JDBC-Connector</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <jmh.version>1.37</jmh.version>
        <junit.version>5.5.2</junit.version>
        <junit-pioneer.version>1.9.1</junit-pioneer.version>
        <assertj.version>3.24.2</assertj.version>
        <osgi.version>6.0.0</osgi.version>
        <osgi.compendium.version>5.0.0</osgi.compendium.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <logback.version>1.4.14</logback.version>
        <logback-java8.version>1.3.12</logback-java8.version>
        <jacoco.version>0.8.11</jacoco.version>
        <waffle-jna.version>3.3.0</waffle-jna.version>
        <bnd-maven-plugin.version>6.3.1</bnd-maven-plugin.version>
        <spotless.version>2.40.0</spotless.version>
        <jna.version>5.11.0</jna.version>
        <mysql-connector-java.version>8.0.33</mysql-connector-java.version>
        <mariadb-connector-java.version>3.3.0</mariadb-connector-java.version>
    </properties>

    <licenses>
        <license>
            <name>LGPL-2.1</name>
        </license>
    </licenses>

    <organization>
        <name>SingleStore</name>
        <url>https://www.singlestore.com/</url>
    </organization>

    <developers>
        <developer>
            <id>singlestore</id>
            <name>SingleStore</name>
            <email>team@singlestore.com</email>
            <organization>SingleStore</organization>
            <organizationUrl>https://www.singlestore.com/</organizationUrl>
        </developer>
    </developers>

    <scm>
        <url>git://git@github.com:memsql/S2-JDBC-Connector.git</url>
        <connection>scm:git:git@github.com:memsql/S2-JDBC-Connector.git</connection>
        <developerConnection>scm:git:git@github.com:memsql/S2-JDBC-Connector.git</developerConnection>
        <tag>singlestore-jdbc-client-1.2.5</tag>
    </scm>

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

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>${junit.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>software.amazon.awssdk</groupId>
                <artifactId>bom</artifactId>
                <version>2.21.1</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.4.1</version>
                <configuration>
                    <source>8</source>
                    <excludePackageNames>
                        com.singlestore.jdbc.client,com.singlestore.jdbc.codec,com.singlestore.jdbc.message,com.singlestore.jdbc.util
                    </excludePackageNames>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.3.0</version>
                <configuration>
                    <archive>
                        <manifestEntries>
                            <Multi-Release>true</Multi-Release>
                            <Export-Package>com.singlestore.jdbc</Export-Package>
                            <Import-Package>
                                javax.naming,javax.naming.ldap,javax.management,javax.sql,javax.net;resolution:=optional,javax.net.ssl;resolution:=optional,javax.transaction.xa;resolution:=optional,waffle.windows.auth;resolution:=optional,waffle.windows.auth.impl;resolution:=optional,org.ietf.jgss;resolution:=optional,javax.security.auth.login;resolution:=optional,javax.security.auth.x500;resolution:=optional,javax.crypto;resolution:=optional,software.amazon.awssdk.*;resolution:=optional,org.slf4j;resolution:=optional
                            </Import-Package>
                        </manifestEntries>
                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                    </archive>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.2.1</version>
                <executions>
                    <execution>
                        <!--package phase-->
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>1.6.13</version>
                <extensions>true</extensions>
                <executions>
                    <execution>
                        <phase>deploy</phase>
                    </execution>
                </executions>
                <configuration>
                    <serverId>ossrh</serverId>
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                    <stagingProgressTimeoutMinutes>15</stagingProgressTimeoutMinutes>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>3.0.1</version>
                <executions>
                    <execution>
                        <phase>verify</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.cosium.code</groupId>
                <artifactId>git-code-format-maven-plugin</artifactId>
                <version>2.7</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>install-hooks</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>[3.5.4,)</version>
                                </requireMavenVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.10.1</version>
                    <configuration>
                        <showWarnings>true</showWarnings>
                        <source>1.8</source>
                        <target>1.8</target>
                        <compilerArgs>
                            <arg>-Xlint:all,-options,-path,-processing</arg>
                        </compilerArgs>
                    </configuration>
                    <executions>
                        <execution>
                            <id>compile-java-8</id>
                            <goals>
                                <goal>compile</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>compile-java-9</id>
                            <phase>compile</phase>
                            <goals>
                                <goal>compile</goal>
                            </goals>
                            <configuration>
                                <release>9</release>
                                <source>9</source>
                                <target>9</target>
                                <compilerArgs>
                                    <arg>--add-exports</arg>
                                    <arg>jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
                                    <arg>--add-exports</arg>
                                    <arg>jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
                                    <arg>--add-exports</arg>
                                    <arg>jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
                                    <arg>--add-exports</arg>
                                    <arg>jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
                                    <arg>--add-exports</arg>
                                    <arg>jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
                                </compilerArgs>
                                <compileSourceRoots>
                                    <compileSourceRoot>${project.basedir}/src/main/java9</compileSourceRoot>
                                </compileSourceRoots>
                                <multiReleaseOutput>true</multiReleaseOutput>
                            </configuration>
                        </execution>
                        <execution>
                            <id>compile-java-11</id>
                            <phase>compile</phase>
                            <goals>
                                <goal>compile</goal>
                            </goals>
                            <configuration>
                                <release>11</release>
                                <source>11</source>
                                <target>11</target>
                                <compileSourceRoots>
                                    <compileSourceRoot>${project.basedir}/src/main/java11</compileSourceRoot>
                                </compileSourceRoots>
                                <multiReleaseOutput>true</multiReleaseOutput>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.core</artifactId>
            <version>${osgi.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.compendium</artifactId>
            <version>${osgi.compendium.version}</version>
            <scope>provided</scope>
        </dependency>

        <!--logging-->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>2.0.4</version>
            <optional>true</optional>
        </dependency>

        <!--test dependencies-->
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>${assertj.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit-pioneer</groupId>
            <artifactId>junit-pioneer</artifactId>
            <version>${junit-pioneer.version}</version>
            <scope>test</scope>
        </dependency>

        <!--GSSAPI authentication plugin dependency-->
        <dependency>
            <groupId>com.github.waffle</groupId>
            <artifactId>waffle-jna</artifactId>
            <version>1.9.1</version>
            <optional>true</optional>
        </dependency>

        <!--AWS-IAM BROWSER credential plugin dependency-->
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>rds</artifactId>
            <optional>true</optional>
        </dependency>

        <!--BROWSER_SSO credential plugin dependencies-->
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.13</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>de.swiesend</groupId>
            <artifactId>secret-service</artifactId>
            <version>1.7.0</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>net.java.dev.jna</groupId>
            <artifactId>jna</artifactId>
            <version>${jna.version}</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>net.java.dev.jna</groupId>
            <artifactId>jna-platform</artifactId>
            <version>${jna.version}</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jsr310</artifactId>
            <version>2.13.2</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.auth0</groupId>
            <artifactId>java-jwt</artifactId>
            <version>3.19.0</version>
            <optional>true</optional>
        </dependency>
    </dependencies>


    <profiles>
        <profile>
            <id>java8</id>
            <dependencies>
                <dependency>
                    <groupId>ch.qos.logback</groupId>
                    <artifactId>logback-classic</artifactId>
                    <version>${logback-java8.version}</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>3.10.1</version>
                        <configuration>
                            <showWarnings>true</showWarnings>
                            <compilerArgs>
                                <arg>-Xlint:all,-options,-path,-processing</arg>
                            </compilerArgs>
                            <source>1.8</source>
                            <target>1.8</target>
                        </configuration>
                        <executions>
                            <execution>
                                <id>compile-java-8</id>
                                <goals>
                                    <goal>compile</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>default</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.22.2</version>
                        <configuration>
                            <argLine>--illegal-access=warn</argLine>
                        </configuration>
                    </plugin>

                    <plugin>
                        <!--create an uberjar with BROWSER_SSO dependencies-->
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-shade-plugin</artifactId>
                        <version>3.2.1</version>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>shade</goal>
                                </goals>
                                <configuration>
                                    <finalName>singlestore-jdbc-client-${version}-browser-sso-uber</finalName>
                                    <filters>
                                        <filter>
                                            <artifact>*:*</artifact>
                                            <excludes>
                                                <exclude>META-INF/*.SF</exclude>
                                                <exclude>META-INF/*.DSA</exclude>
                                                <exclude>META-INF/*.RSA</exclude>
                                            </excludes>
                                        </filter>
                                    </filters>
                                    <artifactSet>
                                        <includes>
                                            <include>com.fasterxml.jackson.datatype:jackson-datatype-jsr310</include>
                                            <include>com.fasterxml.jackson.core:*</include>
                                            <include>com.auth0:java-jwt</include>
                                            <include>org.slf4j:slf4j-api</include>
                                            <include>org.apache.httpcomponents:*</include>

                                            <!--Linux keyring dependencies-->
                                            <include>de.swiesend:secret-service</include>
                                            <include>at.favre.lib:hkdf</include>
                                            <include>com.github.hypfvieh:dbus-java</include>
                                            <include>com.github.jnr:*</include>
                                            <include>org.ow2.asm:*</include>

                                            <!--Windows and Mac keyring dependencies-->
                                            <include>net.java.dev.jna:*</include>
                                        </includes>
                                    </artifactSet>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <version>${jacoco.version}</version>
                        <configuration>
                            <destFile>${jacoco.reportPath}</destFile>
                            <append>true</append>
                            <excludes>
                                <exclude>META-INF/**</exclude>
                            </excludes>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>report</id>
                                <phase>test</phase>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <dependencies>
                <dependency>
                    <groupId>ch.qos.logback</groupId>
                    <artifactId>logback-classic</artifactId>
                    <version>${logback.version}</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>test-jdk</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-toolchains-plugin</artifactId>
                        <version>3.0.0</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>toolchain</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <toolchains>
                                <jdk>
                                    <version>11</version>
                                </jdk>
                            </toolchains>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>3.2.3</version>
                        <executions>
                            <execution>
                                <id>jdk-8</id>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                                <configuration>
                                    <jdkToolchain>
                                        <version>8</version>
                                        <vendor>openJdk</vendor>
                                    </jdkToolchain>
                                </configuration>
                            </execution>
                            <execution>
                                <id>jdk-11</id>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                                <configuration>
                                    <jdkToolchain>
                                        <version>11</version>
                                        <vendor>openJdk</vendor>
                                    </jdkToolchain>
                                </configuration>
                            </execution>
                            <execution>
                                <id>jdk-17</id>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                                <configuration>
                                    <jdkToolchain>
                                        <version>17</version>
                                        <vendor>openJdk</vendor>
                                    </jdkToolchain>
                                </configuration>
                            </execution>
                            <execution>
                                <id>jdk-21</id>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                                <configuration>
                                    <jdkToolchain>
                                        <version>21</version>
                                        <vendor>openJdk</vendor>
                                    </jdkToolchain>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>bench</id>
            <dependencies>
                <dependency>
                    <groupId>org.openjdk.jmh</groupId>
                    <artifactId>jmh-core</artifactId>
                    <version>${jmh.version}</version>
                </dependency>
                <dependency>
                    <groupId>ch.qos.logback</groupId>
                    <artifactId>logback-classic</artifactId>
                    <version>${logback.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.openjdk.jmh</groupId>
                    <artifactId>jmh-generator-annprocess</artifactId>
                    <version>${jmh.version}</version>
                </dependency>
                <dependency>
                    <groupId>mysql</groupId>
                    <artifactId>mysql-connector-java</artifactId>
                    <version>${mysql-connector-java.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.mariadb.jdbc</groupId>
                    <artifactId>mariadb-java-client</artifactId>
                    <version>${mariadb-connector-java.version}</version>
                </dependency>
            </dependencies>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>3.10.1</version>
                        <configuration>
                            <showWarnings>true</showWarnings>
                            <compilerArgs>
                                <arg>-Xlint:all,-options,-path,-processing</arg>
                            </compilerArgs>
                            <source>1.8</source>
                            <target>1.8</target>
                        </configuration>
                        <executions>
                            <execution>
                                <id>compile-java-8</id>
                                <goals>
                                    <goal>compile</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>compile-java-9</id>
                                <phase>compile</phase>
                                <goals>
                                    <goal>compile</goal>
                                </goals>
                                <configuration>
                                    <release>9</release>
                                    <source>9</source>
                                    <target>9</target>
                                    <compilerArgs>
                                        <arg>--add-exports</arg>
                                        <arg>jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
                                        <arg>--add-exports</arg>
                                        <arg>jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
                                        <arg>--add-exports</arg>
                                        <arg>jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
                                        <arg>--add-exports</arg>
                                        <arg>jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
                                        <arg>--add-exports</arg>
                                        <arg>jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
                                    </compilerArgs>
                                    <compileSourceRoots>
                                        <compileSourceRoot>${project.basedir}/src/main/java9</compileSourceRoot>
                                    </compileSourceRoots>
                                    <multiReleaseOutput>true</multiReleaseOutput>
                                </configuration>
                            </execution>
                            <execution>
                                <id>compile-java-11</id>
                                <phase>compile</phase>
                                <goals>
                                    <goal>compile</goal>
                                </goals>
                                <configuration>
                                    <release>11</release>
                                    <source>11</source>
                                    <target>11</target>
                                    <compileSourceRoots>
                                        <compileSourceRoot>${project.basedir}/src/main/java11</compileSourceRoot>
                                    </compileSourceRoots>
                                    <multiReleaseOutput>true</multiReleaseOutput>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <version>3.0.0</version>
                        <executions>
                            <execution>
                                <id>add-source</id>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>add-source</goal>
                                </goals>
                                <configuration>
                                    <sources>
                                        <source>src/benchmark/java</source>
                                    </sources>
                                </configuration>
                            </execution>
                            <execution>
                                <id>add-resource</id>
                                <phase>generate-resources</phase>
                                <goals>
                                    <goal>add-resource</goal>
                                </goals>
                                <configuration>
                                    <resources>
                                        <resource>
                                            <directory>src/benchmark/resources</directory>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-shade-plugin</artifactId>
                        <version>3.2.1</version>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>shade</goal>
                                </goals>
                                <configuration>
                                    <finalName>benchmarks</finalName>
                                    <transformers>
                                        <transformer
                                                implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                            <mainClass>org.openjdk.jmh.Main</mainClass>
                                        </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>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
