<?xml version="1.0" encoding="UTF-8"?>
<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">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.cognite</groupId>
    <artifactId>beam-connector-java</artifactId>
    <version>0.9.27</version>
    <licenses>
        <license>
            <name>Apache 2</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <name>${project.groupId}:${project.artifactId}</name>
    <description>Beam I/O connector for reading and writing from/to CDF resources.</description>
    <url>https://github.com/cognitedata/cdp-beam-connector-java</url>
    <organization>
        <name>Cognite AS</name>
        <url>https://cognite.com</url>
    </organization>
    <developers>
        <developer>
            <name>Kjetil Halvorsen</name>
            <email>kjetil.halvorsen@cognite.com</email>
            <organization>Cognite</organization>
            <organizationUrl>https://cognite.com</organizationUrl>
        </developer>
    </developers>
    <scm>
        <connection>scm:git:git://github.com/cognitedata/cdf-beam-connector-java.git</connection>
        <developerConnection>scm:git:ssh://github.com/cognitedata/cdf-beam-connector-java.git</developerConnection>
        <url>https://github.com/cognitedata/cdf-beam-connector-java/tree/main</url>
    </scm>

    <properties>
        <java.version>11</java.version>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <beam.version>2.33.0</beam.version>
        <cdf-java-sdk.version>1.3.0</cdf-java-sdk.version>
        <auto.version>1.8.2</auto.version>
        <auto-service.version>1.0</auto-service.version>
        <tomlj.version>1.0.0</tomlj.version>
        <junit.version>5.7.2</junit.version>
        <jackson-yaml.version>2.12.3</jackson-yaml.version>

        <maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
        <maven-exec-plugin.version>3.0.0</maven-exec-plugin.version>
        <compiler.error.flag>-Werror</compiler.error.flag>
        <compiler.default.pkginfo.flag>-Xpkginfo:always</compiler.default.pkginfo.flag>
        <compiler.default.exclude>nothing</compiler.default.exclude>

        <build-helper-maven-plugin.version>3.2.0</build-helper-maven-plugin.version>
        <maven-antrun-plugin.version>3.0.0</maven-antrun-plugin.version>
        <maven-dependency-plugin.version>3.1.2</maven-dependency-plugin.version>
        <maven-shade-plugin.version>3.2.4</maven-shade-plugin.version>
        <os-maven-plugin.version>1.6.2</os-maven-plugin.version>
        <maven-surefire-plugin.version>3.0.0-M5</maven-surefire-plugin.version>
        <maven-javadoc-plugin.version>3.2.0</maven-javadoc-plugin.version>
        <maven-source-plugin.version>3.2.0</maven-source-plugin.version>
        <maven-site-plugin.version>3.9.1</maven-site-plugin.version>
        <maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
        <nexus-staging-maven-plugin.version>1.6.7</nexus-staging-maven-plugin.version>
        <moshi-plugin.version>1.1.0</moshi-plugin.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.google.cloud</groupId>
                <artifactId>libraries-bom</artifactId>
                <version>20.7.0</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>com.google.auto.value</groupId>
            <artifactId>auto-value-annotations</artifactId>
            <version>${auto.version}</version>
        </dependency>
        <dependency>
            <groupId>com.google.auto.service</groupId>
            <artifactId>auto-service-annotations</artifactId>
            <version>${auto-service.version}</version>
        </dependency>
        <dependency>
            <groupId>com.cognite</groupId>
            <artifactId>cdf-sdk-java</artifactId>
            <version>${cdf-java-sdk.version}</version>
        </dependency>
        <dependency>
            <groupId>com.google.cloud</groupId>
            <artifactId>google-cloud-secretmanager</artifactId>
        </dependency>
        <dependency>
            <groupId>org.tomlj</groupId>
            <artifactId>tomlj</artifactId>
            <version>${tomlj.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.beam</groupId>
            <artifactId>beam-sdks-java-core</artifactId>
            <version>${beam.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.beam</groupId>
            <artifactId>beam-runners-direct-java</artifactId>
            <version>${beam.version}</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.beam</groupId>
            <artifactId>beam-sdks-java-extensions-protobuf</artifactId>
            <version>${beam.version}</version>
        </dependency>
        <dependency>
            <groupId>com.ryanharter.auto.value</groupId>
            <artifactId>auto-value-moshi-runtime</artifactId>
            <version>${moshi-plugin.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-yaml</artifactId>
            <version>${jackson-yaml.version}</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
       <dependency>
           <groupId>ch.qos.logback</groupId>
           <artifactId>logback-classic</artifactId>
           <version>1.2.5</version>
           <scope>test</scope>
       </dependency>
   </dependencies>

   <build>
       <extensions>
                   <!-- provides os.detected.classifier (i.e. linux-x86_64, osx-x86_64) property -->
            <extension>
                <groupId>kr.motd.maven</groupId>
                <artifactId>os-maven-plugin</artifactId>
                <version>${os-maven-plugin.version}</version>
            </extension>
        </extensions>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>${build-helper-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${basedir}/target/generated-sources</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <useIncrementalCompilation>false</useIncrementalCompilation>
                    <compilerArgs>
                        <arg>-Xlint:all</arg>
                        <arg>${compiler.error.flag}</arg>
                        <!-- Override options warnings to support cross-compilation -->
                        <arg>-Xlint:-options</arg>
                        <!-- Temporary lint overrides, to be removed over time. -->
                        <arg>-Xlint:-cast</arg>
                        <arg>-Xlint:-deprecation</arg>
                        <arg>-Xlint:-processing</arg>
                        <arg>-Xlint:-rawtypes</arg>
                        <arg>-Xlint:-serial</arg>
                        <arg>-Xlint:-try</arg>
                        <arg>-Xlint:-unchecked</arg>
                        <arg>-Xlint:-varargs</arg>
                        <!-- Uncomment the following args to display more warnings. -->
                        <!-- -Xmaxwarns -->
                        <!-- 10000 -->
                    </compilerArgs>
                    <showWarnings>true</showWarnings>
                    <!-- Another temp override, to be set to true in due course. -->
                    <showDeprecation>false</showDeprecation>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>com.google.auto.value</groupId>
                            <artifactId>auto-value</artifactId>
                            <version>${auto.version}</version>
                        </path>
                        <path>
                            <groupId>com.google.auto.service</groupId>
                            <artifactId>auto-service</artifactId>
                            <version>${auto-service.version}</version>
                        </path>
                        <path>
                            <groupId>com.ryanharter.auto.value</groupId>
                            <artifactId>auto-value-moshi-extension</artifactId>
                            <version>${moshi-plugin.version}</version>
                        </path>
                        <dependency>
                            <groupId>com.squareup</groupId>
                            <artifactId>javapoet</artifactId>
                            <version>1.12.0</version>
                        </dependency>
                        <dependency>
                            <groupId>com.squareup.moshi</groupId>
                            <artifactId>moshi</artifactId>
                            <version>1.9.2</version>
                        </dependency>
                        <dependency>
                            <groupId>io.sweers.autotransient</groupId>
                            <artifactId>autotransient</artifactId>
                            <version>1.0.0</version>
                        </dependency>

                    </annotationProcessorPaths>
                </configuration>
                <executions>
                    <execution>
                        <id>default-compile</id>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <phase>compile</phase>
                        <configuration>
                            <compilerArgs>
                                <arg>${compiler.default.pkginfo.flag}</arg>
                            </compilerArgs>
                            <excludes>
                                <exclude>${compiler.default.exclude}</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin.version}</version>
                <configuration>
                    <skipTests>false</skipTests>
                    <excludedGroups>remoteCDP, remoteCDF</excludedGroups>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>${maven-exec-plugin.version}</version>
                <configuration>
                    <cleanupDaemonThreads>false</cleanupDaemonThreads>
                    <systemProperties>
                        <systemProperty>
                            <key>java.util.logging.config.file</key>
                            <value>logging.properties</value>
                        </systemProperty>
                    </systemProperties>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>${maven-site-plugin.version}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>1.4.1</version>
                <configuration>
                    <rules><dependencyConvergence/></rules>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven-javadoc-plugin.version}</version>
                <configuration>
                    <goal>javadoc</goal>
                </configuration>
            </plugin>
        </plugins>
    </reporting>

    <profiles>
        <profile>
            <id>release</id>
            <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>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>${maven-source-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${maven-javadoc-plugin.version}</version>
                        <configuration>
                            <doclint>none</doclint>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadoc</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven-gpg-plugin.version}</version>
                        <configuration>
                            <!-- Prevent gpg from using pinentry programs -->
                            <gpgArguments>
                                <arg>--pinentry-mode</arg>
                                <arg>loopback</arg>
                            </gpgArguments>
                        </configuration>
                        <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>${nexus-staging-maven-plugin.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
