<?xml version="1.0" encoding="UTF-8"?>
<!--~
    ~ Copyright 2023 Couchbase, Inc.
    ~
    ~ Licensed 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: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.couchbase.client</groupId>
    <artifactId>kafka-connect-couchbase</artifactId>
    <packaging>jar</packaging>
    <version>4.2.7</version>
    <name>Kafka Connector for Couchbase</name>
    <organization>
        <name>Couchbase, Inc.</name>
        <url>https://couchbase.com</url>
    </organization>
    <url>https://couchbase.com</url>
    <description>
        A Kafka Connect Couchbase connector for copying data between Kafka and Couchbase Server.
    </description>

    <licenses>
        <license>
            <name>Apache License 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.html</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:git://github.com/couchbase/kafka-connect-couchbase.git</connection>
        <developerConnection>scm:git:git@github.com:couchbase/kafka-connect-couchbase.git</developerConnection>
        <url>https://github.com/couchbase/kafka-connect-couchbase</url>
        <tag>HEAD</tag>
    </scm>

    <issueManagement>
        <system>Couchbase JIRA</system>
        <url>https://www.couchbase.com/issues/browse/KAFKAC</url>
    </issueManagement>

    <developers>
        <developer>
            <id>avsej</id>
            <name>Sergey Avseyev</name>
            <email>sergey@couchbase.com</email>
        </developer>
        <developer>
            <id>dnault</id>
            <name>David Nault</name>
            <email>david.nault@couchbase.com</email>
        </developer>
    </developers>

    <properties>
        <kafka.version>2.8.2</kafka.version>
        <dcp-client.version>0.53.0</dcp-client.version>
        <java-client.version>3.7.9</java-client.version>
        <runtime.javadoc.version>0.13.0</runtime.javadoc.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <junit.version>5.10.3</junit.version>
        <mockito.version>5.12.0</mockito.version>
        <dist-archive-name>${project.artifactId}-${project.version}.zip</dist-archive-name>

        <!-- Don't sign artifacts unless the 'stage' or 'release' profile is active -->
        <gpg.skip>true</gpg.skip>

        <!-- When deploying, automatically promote artifacts from staging repository -->
        <autoReleaseAfterClose>true</autoReleaseAfterClose>
    </properties>

    <repositories>
        <!-- for DCP client snapshots -->
        <repository>
            <id>sonatype-snapshots</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
            <releases><enabled>false</enabled></releases>
            <snapshots><enabled>true</enabled></snapshots>
        </repository>
    </repositories>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.micrometer</groupId>
                <artifactId>micrometer-bom</artifactId>
                <version>1.10.4</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>connect-api</artifactId>
            <version>${kafka.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>connect-json</artifactId>
            <version>${kafka.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.jspecify</groupId>
            <artifactId>jspecify</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.couchbase.client</groupId>
            <artifactId>java-client</artifactId>
            <version>${java-client.version}</version>
        </dependency>
        <dependency>
            <groupId>com.couchbase.client</groupId>
            <artifactId>dcp-client</artifactId>
            <version>${dcp-client.version}</version>
            <exclusions>
                <!-- SLF4J is provided by Kafka; don't want it in uber jar -->
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.github.therapi</groupId>
            <artifactId>therapi-runtime-javadoc</artifactId>
            <version>${runtime.javadoc.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.15.0</version>
        </dependency>
        <dependency>
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
            <version>1.18.1</version>
        </dependency>
        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-registry-jmx</artifactId>
        </dependency>

        <!-- Test dependencies -->
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>33.2.1-jre</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit.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>
        <plugins>
            <!--
                To refresh the generated docs, run:
                    mvn clean test-compile exec:java
             -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>
                    <mainClass>com.couchbase.connect.kafka.util.config.AsciiDocGenerator</mainClass>
                    <classpathScope>test</classpathScope>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.10.1</version>
                <inherited>true</inherited>
                <configuration>
                    <release>8</release>
                    <annotationProcessorPaths>
                        <!-- Save Javadoc for use in Kafka config definitions. -->
                        <annotationProcessorPath>
                            <groupId>com.github.therapi</groupId>
                            <artifactId>therapi-runtime-javadoc-scribe</artifactId>
                            <version>${runtime.javadoc.version}</version>
                        </annotationProcessorPath>
                    </annotationProcessorPaths>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.2.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.4.1</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <tags>
                        <tag>
                            <name>apiNote</name>
                            <placement>a</placement>
                            <head>API Note:</head>
                        </tag>
                        <tag>
                            <name>implSpec</name>
                            <placement>a</placement>
                            <head>Implementation Requirements:</head>
                        </tag>
                        <tag>
                            <name>implNote</name>
                            <placement>a</placement>
                            <head>Implementation Note:</head>
                        </tag>
                    </tags>
                </configuration>
            </plugin>
            <plugin>
                <groupId>io.confluent</groupId>
                <version>0.12.0</version>
                <artifactId>kafka-connect-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>kafka-connect</goal>
                        </goals>
                        <configuration>
                            <title>Couchbase Connector</title>
                            <documentationUrl>https://docs.couchbase.com/kafka-connector/current/</documentationUrl>
                            <description>
                                The official Couchbase connector developed by Couchbase, Inc.
                            </description>
                            <logo>assets/couchbase_logo.png</logo>

                            <supportProviderName>Couchbase, Inc.</supportProviderName>
                            <supportSummary>Join us on the Couchbase Forums where we provide support free of charge on a best effort basis. Couchbase Enterprise Edition subscribers receive additional support through their normal support channel.</supportSummary>
                            <supportUrl>https://forums.couchbase.com/c/Kafka-Connector/27</supportUrl>
                            <supportLogo>assets/couchbase_logo.png</supportLogo>

                            <ownerUsername>couchbase</ownerUsername>
                            <ownerType>organization</ownerType>
                            <ownerName>Couchbase, Inc.</ownerName>
                            <ownerUrl>https://couchbase.com/</ownerUrl>
                            <ownerLogo>assets/couchbase_logo.png</ownerLogo>

                            <componentTypes>
                                <componentType>sink</componentType>
                                <componentType>source</componentType>
                            </componentTypes>

                            <tags>
                                <tag>Couchbase</tag>
                                <tag>database</tag>
                            </tags>

                            <requirements>
                                <requirement>Couchbase Server 7.0 or later</requirement>
                                <requirement>Confluent Platform 6.2 or later</requirement>
                            </requirements>

                            <deliveryGuarantee>
                                <deliveryGuarantee>atLeastOnce</deliveryGuarantee>
                            </deliveryGuarantee>

                            <kafkaConnectApi>true</kafkaConnectApi>
                            <singleMessageTransforms>true</singleMessageTransforms>
                            <confluentControlCenterIntegration>true</confluentControlCenterIntegration>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.1</version>
                <configuration>
                    <useSystemClassLoader>false</useSystemClassLoader>
                    <argLine>-Djava.awt.headless=true</argLine>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>3.0.1</version>
                <executions>
                    <execution>
                        <id>sign-artifacts</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>sign</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>
                <configuration>
                    <serverId>ossrh</serverId>
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>${autoReleaseAfterClose}</autoReleaseAfterClose>
                </configuration>
            </plugin>
        </plugins>

        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <properties>
                <gpg.skip>false</gpg.skip>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-enforcer-plugin</artifactId>
                        <version>3.1.0</version>
                        <executions>
                            <execution>
                                <id>enforce-release</id>
                                <goals>
                                    <goal>enforce</goal>
                                </goals>
                                <configuration>
                                    <rules>
                                        <requireReleaseVersion>
                                            <message>Not a release version (remove -SNAPSHOT suffix!)</message>
                                        </requireReleaseVersion>
                                        <requireReleaseDeps>
                                            <message>Can't release with snapshot dependencies!</message>
                                        </requireReleaseDeps>
                                    </rules>
                                    <fail>true</fail>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
