<?xml version="1.0" encoding="UTF-8"?>

<!--
  ~ Copyright 2018 Confluent Inc.
  ~
  ~ Licensed under the Confluent Community License (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.confluent.io/confluent-community-license
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  ~ WARRANTIES 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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>io.confluent</groupId>
        <artifactId>kafka-connect-storage-cloud</artifactId>
        <version>5.2.7</version>
    </parent>

    <artifactId>kafka-connect-s3</artifactId>
    <packaging>jar</packaging>
    <name>kafka-connect-s3</name>

    <description>
        Kafka Connect cloud storage connector for Amazon Simple Storage Service (S3).
    </description>

    <properties>
        <aws.version>1.11.725</aws.version>
        <s3mock.version>0.2.5</s3mock.version>
        <kafka.connect.maven.plugin.version>0.11.1</kafka.connect.maven.plugin.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.amazonaws</groupId>
                <artifactId>aws-java-sdk-bom</artifactId>
                <version>${aws.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>com.amazonaws</groupId>
                <artifactId>aws-java-sdk-sts</artifactId>
                <version>${aws.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-s3</artifactId>
        </dependency>
        <!-- Pinning the version of this dependency to address CVE in alignment with
            https://github.com/confluentinc/common/pull/342
            Once the jackson version gets upgraded consider lifting this explicit listing -->
        <dependency>
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-cbor</artifactId>
        </dependency>
        <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-sts</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>${httpclient.version}</version>
        </dependency>
        <dependency>
            <groupId>io.findify</groupId>
            <artifactId>s3mock_2.12</artifactId>
            <version>${s3mock.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>io.confluent</groupId>
                <artifactId>kafka-connect-maven-plugin</artifactId>
                <version>${kafka.connect.maven.plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>kafka-connect</goal>
                        </goals>
                        <configuration>
                            <title>Kafka Connect S3</title>
                            <sourceUrl>https://github.com/confluentinc/kafka-connect-storage-cloud</sourceUrl>
                            <documentationUrl>https://docs.confluent.io/kafka-connect-s3-sink/current/index.html</documentationUrl>
                            <description>
                                The S3 connector, currently available as a sink, allows you to export data from Kafka topics to S3 objects in either Avro or JSON formats. In addition, for certain data layouts, S3 connector exports data by guaranteeing exactly-once delivery semantics to consumers of the S3 objects it produces.

                                Being a sink, the S3 connector periodically polls data from Kafka and in turn uploads it to S3. A partitioner is used to split the data of every Kafka partition into chunks. Each chunk of data is represented as an S3 object, whose key name encodes the topic, the Kafka partition and the start offset of this data chunk. If no partitioner is specified in the configuration, the default partitioner which preserves Kafka partitioning is used. The size of each data chunk is determined by the number of records written to S3 and by schema compatibility.
                            </description>
                            <logo>logos/s3.jpg</logo>

                            <supportProviderName>Confluent, Inc.</supportProviderName>
                            <supportSummary>Confluent supports the S3 sink connector alongside community members as part of its Confluent Platform offering.</supportSummary>
                            <supportUrl>https://docs.confluent.io/current/</supportUrl>
                            <supportLogo>logos/confluent.png</supportLogo>

                            <ownerUsername>confluentinc</ownerUsername>
                            <ownerType>organization</ownerType>
                            <ownerName>Confluent, Inc.</ownerName>
                            <ownerUrl>https://confluent.io/</ownerUrl>
                            <ownerLogo>logos/confluent.png</ownerLogo>

                            <dockerNamespace>confluentinc</dockerNamespace>
                            <dockerName>cp-kafka-connect</dockerName>
                            <dockerTag>${project.version}</dockerTag>

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

                            <tags>
                                <tag>s3</tag>
                                <tag>aws</tag>
                            </tags>

                            <confluentControlCenterIntegration>true</confluentControlCenterIntegration>

                            <requirements>
                                <requirement>AWS S3 bucket with write permissions</requirement>
                            </requirements>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <inherited>true</inherited>
                <executions>
                    <execution>
                        <id>test-compile</id>
                        <phase>process-test-sources</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                        <configuration>
                            <source>1.8</source>
                            <target>1.8</target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptors>
                        <descriptor>src/assembly/development.xml</descriptor>
                        <descriptor>src/assembly/package.xml</descriptor>
                    </descriptors>
                    <attach>false</attach>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>

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

    <profiles>
        <profile>
            <id>standalone</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <configuration>
                            <descriptors>
                                <descriptor>src/assembly/standalone.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>licenses-package</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>1.2.1</version>
                        <executions>
                            <execution>
                                <id>create-licenses</id>
                                <configuration>
                                    <mainClass>io.confluent.licenses.LicenseFinder</mainClass>
                                    <arguments>
                                        <!-- Note use of development instead of package so we pick up all dependencies. -->
                                        <argument>-i
                                            ${project.build.directory}/${project.build.finalName}-package/share/java/${project.name}
                                        </argument>
                                        <argument>-o ${project.basedir}/licenses</argument>
                                        <argument>-f</argument>
                                        <argument>-h
                                            ${project.build.directory}/${project.build.finalName}-package/share/doc/${project.name}/licenses.html
                                        </argument>
                                        <argument>-l
                                            ${project.build.directory}/${project.build.finalName}-package/share/doc/${project.name}/licenses
                                        </argument>
                                        <argument>-n
                                            ${project.build.directory}/${project.build.finalName}-package/share/doc/${project.name}/notices
                                        </argument>
                                        <argument>-t ${project.name}</argument>
                                        <argument>-x licenses-${licenses.version}.jar</argument>
                                    </arguments>
                                </configuration>
                                <phase>package</phase>
                                <goals>
                                    <goal>java</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <includeProjectDependencies>true</includeProjectDependencies>
                            <includePluginDependencies>true</includePluginDependencies>
                            <executableDependency>
                                <groupId>io.confluent</groupId>
                                <artifactId>licenses</artifactId>
                            </executableDependency>
                        </configuration>
                        <dependencies>
                            <dependency>
                                <groupId>io.confluent</groupId>
                                <artifactId>licenses</artifactId>
                                <version>${licenses.version}</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>licenses-source</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>1.2.1</version>
                        <executions>
                            <execution>
                                <id>create-licenses</id>
                                <configuration>
                                    <mainClass>io.confluent.licenses.LicenseFinder</mainClass>
                                    <arguments>
                                        <!-- Note use of development instead of package so we pick up all dependencies. -->
                                        <argument>-i
                                            ${project.build.directory}/${project.build.finalName}-development/share/java/${project.name}
                                        </argument>
                                        <argument>-o ${project.basedir}/licenses</argument>
                                        <argument>-f</argument>
                                        <argument>-h ${project.basedir}/licenses.html</argument>
                                        <argument>-l ${project.basedir}/licenses</argument>
                                        <argument>-n ${project.basedir}/notices</argument>
                                        <argument>-t ${project.name}</argument>
                                        <argument>-x licenses-${licenses.version}.jar</argument>
                                    </arguments>
                                </configuration>
                                <phase>package</phase>
                                <goals>
                                    <goal>java</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <includeProjectDependencies>true</includeProjectDependencies>
                            <includePluginDependencies>true</includePluginDependencies>
                            <executableDependency>
                                <groupId>io.confluent</groupId>
                                <artifactId>licenses</artifactId>
                            </executableDependency>
                        </configuration>
                        <dependencies>
                            <dependency>
                                <groupId>io.confluent</groupId>
                                <artifactId>licenses</artifactId>
                                <version>${licenses.version}</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                    <plugin>
                        <artifactId>maven-clean-plugin</artifactId>
                        <version>3.0.0</version>
                        <configuration>
                            <filesets>
                                <fileset>
                                    <directory>.</directory>
                                    <includes>
                                        <include>licenses.html</include>
                                        <directory>licenses/*.*</directory>
                                        <directory>notices/*.*</directory>
                                    </includes>
                                </fileset>
                            </filesets>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
