<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>io.github.kai-niemi.cockroachdb.jdbc</groupId>
    <artifactId>cockroachdb-jdbc</artifactId>
    <version>2.0.2</version>
    <packaging>jar</packaging>

    <name>${project.artifactId}</name>
    <description>JDBC driver for CockroachDB wrapping pgjdbc</description>
    <url>https://github.com/cloudneutral/cockroachdb-jdbc</url>

    <properties>
        <java.version>17</java.version>
        <source.level>17</source.level>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <maven.compiler.xlint.extras/>
        <groups>unit-test</groups>
        <gpg.keyname>0x57278C48</gpg.keyname>

        <postgresql.version>42.7.8</postgresql.version>
        <antlr4.version>4.13.2</antlr4.version>
        <slf4j.version>2.0.17</slf4j.version>
        <logback.version>1.5.19</logback.version>
        <mockito.version>5.20.0</mockito.version>
        <junit-jupiter.version>5.14.0</junit-jupiter.version>
    </properties>

    <inceptionYear>2023</inceptionYear>

    <scm>
        <connection>scm:git:git@github.com:cloudneutral/cockroachdb-jdbc.git</connection>
        <developerConnection>scm:git:ssh://git@github.com:cloudneutral/cockroachdb-jdbc.git</developerConnection>
        <url>https://github.com/cloudneutral/cockroachdb-jdbc.git</url>
        <tag>HEAD</tag>
    </scm>

    <developers>
        <developer>
            <name>Kai Niemi</name>
            <organization>Cockroach Labs</organization>
            <organizationUrl>https://www.cockroachlabs.com/</organizationUrl>
            <timezone>UTC+1</timezone>
            <email>admin@cloudneutral.se</email>
        </developer>
    </developers>

    <licenses>
        <license>
            <name>The MIT License</name>
            <url>https://opensource.org/licenses/MIT</url>
        </license>
    </licenses>

    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/cloudneutral/cockroachdb-jdbc/issues</url>
    </issueManagement>

    <dependencies>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>${postgresql.version}</version>
        </dependency>
        <dependency>
            <groupId>org.antlr</groupId>
            <artifactId>antlr4-runtime</artifactId>
            <version>${antlr4.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
        </dependency>

        <!-- Test scoped -->
        <dependency>
            <groupId>com.zaxxer</groupId>
            <artifactId>HikariCP</artifactId>
            <version>7.0.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.ttddyy</groupId>
            <artifactId>datasource-proxy</artifactId>
            <version>1.11.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
            <version>${logback.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit-jupiter.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <version>${junit-jupiter.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.14.1</version>
                    <configuration>
                        <parameters>true</parameters>
                        <showDeprecation>false</showDeprecation>
                        <showWarnings>false</showWarnings>
                        <source>${source.level}</source>
                        <target>${source.level}</target>
                        <compilerArgs>
                            <arg>-Xlint:all${maven.compiler.xlint.extras}</arg>
                        </compilerArgs>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.4.2</version>
                    <configuration>
                        <archive>
                            <manifestEntries>
                                <Implementation-Title>${project.name}</Implementation-Title>
                                <Implementation-Version>${project.version}</Implementation-Version>
                            </manifestEntries>
                        </archive>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.antlr</groupId>
                    <artifactId>antlr4-maven-plugin</artifactId>
                    <version>${antlr4.version}</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>antlr4</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <sourceDirectory>src/main/resources</sourceDirectory>
                        <includes>
                            <include>**/CockroachSQLParser.g4</include>
                            <include>**/CockroachSQLLexer.g4</include>
                        </includes>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>3.3.1</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>3.11.3</version>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>3.5.4</version>
                    <configuration>
                        <groups>${groups}</groups>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>3.5.0</version>
                    <configuration>
                        <failOnError>false</failOnError>
                        <filesets>
                            <fileset>
                                <directory>${basedir}</directory>
                                <includes>
                                    <include>*.log</include>
                                    <include>*.gz</include>
                                    <include>*.tmp</include>
                                </includes>
                            </fileset>
                        </filesets>
                    </configuration>
                </plugin>

                <!-- Release related plugins -->
                <plugin>
                    <groupId>com.amashchenko.maven.plugin</groupId>
                    <artifactId>gitflow-maven-plugin</artifactId>
                    <version>1.21.0</version>
                    <configuration>
                        <fetchRemote>false</fetchRemote>
                        <verbose>true</verbose>
                        <gitFlowConfig>
                            <!-- Single branch model -->
                            <productionBranch>main</productionBranch>
                            <developmentBranch>main</developmentBranch>
                        </gitFlowConfig>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>1.6</version>
                    <executions>
                        <execution>
                            <id>sign-artifacts</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>sign</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <keyname>${gpg.keyname}</keyname>
                        <passphraseServerId>${gpg.keyname}</passphraseServerId>
                        <gpgArguments>
                            <arg>--pinentry-mode</arg>
                            <arg>loopback</arg>
                        </gpgArguments>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.sonatype.central</groupId>
                    <artifactId>central-publishing-maven-plugin</artifactId>
                    <version>0.7.0</version>
                    <extensions>true</extensions>
                    <configuration>
                        <publishingServerId>central</publishingServerId>
                        <autoPublish>false</autoPublish>
                        <skipPublishing>true</skipPublishing>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.antlr</groupId>
                <artifactId>antlr4-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>com.amashchenko.maven.plugin</groupId>
                <artifactId>gitflow-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <!-- Used by github actions -->
        <profile>
            <id>ci-test-coverage</id>
            <properties>
                <groups>unit-test</groups>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <version>0.8.14</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>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>ci-release</id>
            <properties>
                <skipTests>true</skipTests>
            </properties>
            <build>
                <!-- Maven central related plugins -->
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Integration tests matching group tags -->
        <profile>
            <id>it-local</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <groups>integration-test</groups>
                            <excludedGroups>unit-test,interactive-test</excludedGroups>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <!-- Integration tests matching group tags -->
        <profile>
            <id>it-dev</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <groups>integration-test</groups>
                            <excludedGroups>unit-test,interactive-test</excludedGroups>
                            <systemPropertyVariables>
                                <datasource.url>jdbc:cockroachdb://0.0.0.0:26257/defaultdb?sslmode=disable</datasource.url>
                                <datasource.user>root</datasource.user>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
