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

    <artifactId>cloudant-parent</artifactId>

    <name>IBM Cloudant Java SDK</name>

    <description>Official Java client library and SDK for IBM Cloudant database</description>

    <url>https://github.com/IBM/cloudant-java-sdk</url>

    <groupId>com.ibm.cloud</groupId>
    <version>0.9.3</version>
    <packaging>pom</packaging>

    <properties>
        <sdk-core-version>9.22.0</sdk-core-version>

        <git-repository-name>cloudant-java-sdk</git-repository-name>

        <testng-version>7.7.1</testng-version>
        <okhttp3-version>4.12.0</okhttp3-version>
        <surefire-version>3.5.2</surefire-version>
        <jacoco-plugin-version>0.8.12</jacoco-plugin-version>
        <maven-deploy-plugin-version>3.1.3</maven-deploy-plugin-version>
        <maven-source-plugin-version>3.3.1</maven-source-plugin-version>
        <nexus-staging-plugin-version>1.7.0</nexus-staging-plugin-version>
        <maven-gpg-plugin-version>3.2.7</maven-gpg-plugin-version>
        <maven-source-plugin-version>3.3.1</maven-source-plugin-version>
        <maven-jar-plugin-version>3.4.2</maven-jar-plugin-version>
        <maven-javadoc-plugin-version>3.11.1</maven-javadoc-plugin-version>
        <maven-compiler-plugin-version>3.13.0</maven-compiler-plugin-version>
        <maven-site-plugin-version>3.21.0</maven-site-plugin-version>
        <maven-checkstyle-plugin-version>3.6.0</maven-checkstyle-plugin-version>
        <maven-reports-plugin-version>3.8.0</maven-reports-plugin-version>
        <maven-failsafe-plugin-version>3.5.2</maven-failsafe-plugin-version>
        <maven-buildnumber-plugin-version>3.2.1</maven-buildnumber-plugin-version>
        <mockito-version>5.14.2</mockito-version>
        <slf4j-version>2.0.16</slf4j-version>

        <!-- Set UTF-8 encoding -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <modules>
        <!-- This module should always be listed first -->
        <module>modules/common</module>

        <!-- >>> List each service's module here -->
        <module>modules/cloudant</module>

        <!-- This module skips deployment as it is just reporting -->
        <module>modules/coverage-reports</module>

        <!-- A module that deploys is needed last because nexus-staging-maven-plugin deployment is batched
        until the final module -->
        <!-- This module should always be listed last -->
        <module>modules/examples</module>
    </modules>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

    <organization>
        <name>IBM Corporation</name>
    </organization>

    <scm>
        <connection>scm:git:https://github.com/IBM/cloudant-java-sdk</connection>
        <developerConnection>scm:git:https://github.com/IBM/cloudant-java-sdk</developerConnection>
        <url>https://github.com/IBM/cloudant-java-sdk/tree/master</url>
    </scm>

    <issueManagement>
        <system>Github</system>
        <url>https://github.com/IBM/cloudant-java-sdk/issues</url>
    </issueManagement>

    <ciManagement>
        <system>Travis-CI</system>
        <url>https://travis-ci.com/IBM/cloudant-java-sdk/</url>
    </ciManagement>

    <profiles>
        <profile>
            <!-- "public" is used to deploy public artifacts on maven central -->
            <id>public</id>
            <distributionManagement>
                <snapshotRepository>
                    <!-- We don't deploy snapshot releases -->
                </snapshotRepository>
                <repository>
                    <!-- This is where the nexus staging plugin will publish artifacts -->
                    <id>ossrh</id>
                    <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
                </repository>
            </distributionManagement>
            <build>
                <plugins>
                    <!-- Disable default maven-deploy-plugin -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-deploy-plugin</artifactId>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </plugin>
                    <!-- Enable alternate nexus-staging-maven-plugin -->
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                            <keepStagingRepositoryOnCloseRuleFailure>true</keepStagingRepositoryOnCloseRuleFailure>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>signing</id>
            <!-- configure for signing artifacts when the SIGNING_KEYFILE env var is set -->
            <activation>
                <property>
                    <name>env.CODE_SIGNING_PFX_FILE</name>
                </property>
            </activation>
            <build>
                <plugins>
                  <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-gpg-plugin</artifactId>
                      <executions>
                          <execution>
                              <goals>
                                  <goal>sign</goal>
                              </goals>
                          </execution>
                      </executions>
                      <configuration>
                          <executable>/opt/Garantir/bin/gpg</executable>
                          <homedir>/home/jenkins/.gnupggrs</homedir>
                          <keyname>${env.SIGNING_KEYID}</keyname>
                          <useAgent>true</useAgent>
                      </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>skipunits</id>
            <activation>
              <property>
                <name>skipTests</name>
              </property>
            </activation>
            <properties>
                <skip.unit.tests>${skipTests}</skip.unit.tests>
            </properties>
        </profile>
        <!-- Checkstyle 10+ requires Java 11+ -->
        <profile>
            <id>checkstyle-jdk11+</id>
            <activation>
                <jdk>(,11)</jdk>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-checkstyle-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>verify-style</id>
                                <phase>none</phase>
                            </execution>
                        </executions>
                </plugin>
            </plugins>
            </build>
        </profile>
    </profiles>

    <dependencyManagement>
        <dependencies>
            <!-- This is the Java core dependency -->
            <dependency>
                <groupId>com.ibm.cloud</groupId>
                <artifactId>sdk-core</artifactId>
                <version>${sdk-core-version}</version>
            </dependency>

            <!-- Each module (except "common") should depend on this artifact -->
            <dependency>
                <artifactId>cloudant.sdk.common</artifactId>
                <groupId>${project.groupId}</groupId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <artifactId>cloudant.sdk.common</artifactId>
                <groupId>${project.groupId}</groupId>
                <version>${project.version}</version>
                <type>test-jar</type>
                <classifier>tests</classifier>
                <scope>test</scope>
            </dependency>

            <!-- TestNG is used to run unit/integration tests -->
            <dependency>
                <groupId>org.testng</groupId>
                <artifactId>testng</artifactId>
                <version>${testng-version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>com.squareup.okhttp3</groupId>
                <artifactId>okhttp</artifactId>
                <version>${okhttp3-version}</version>
            </dependency>
            <dependency>
                <groupId>com.squareup.okhttp3</groupId>
                <artifactId>mockwebserver</artifactId>
                <version>${okhttp3-version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
              <groupId>org.mockito</groupId>
              <artifactId>mockito-core</artifactId>
              <version>${mockito-version}</version>
              <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>${maven-deploy-plugin-version}</version>
                </plugin>
                <plugin>
                    <groupId>org.sonatype.plugins</groupId>
                    <artifactId>nexus-staging-maven-plugin</artifactId>
                    <version>${nexus-staging-plugin-version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>${maven-gpg-plugin-version}</version>
                </plugin>
                <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</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${maven-javadoc-plugin-version}</version>
                    <configuration>
                        <quiet>true</quiet>
                        <links>
                            <link>https://ibm.github.io/java-sdk-core/docs/${sdk-core-version}/</link>
                        </links>
                    </configuration>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven-compiler-plugin-version}</version>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </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-checkstyle-plugin</artifactId>
                    <version>${maven-checkstyle-plugin-version}</version>
                    <dependencies>
                        <dependency>
                            <groupId>com.puppycrawl.tools</groupId>
                            <artifactId>checkstyle</artifactId>
                            <version>10.2</version>
                        </dependency>
                    </dependencies>
                    <executions>
                        <execution>
                            <id>verify-style</id>
                            <phase>test</phase>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <failsOnError>true</failsOnError>
                        <configLocation>checkstyle.xml</configLocation>
                        <consoleOutput>true</consoleOutput>
                        <suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
                        <suppressionsFileExpression>checkstyle.suppressions.file</suppressionsFileExpression>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${jacoco-plugin-version}</version>
                    <executions>
                        <execution>
                            <id>prepare-agent</id>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>report</id>
                            <phase>test</phase>
                            <goals>
                                <goal>report</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <systemPropertyVariables>
                            <jacoco-agent.destfile>${project.build.directory}</jacoco-agent.destfile>
                        </systemPropertyVariables>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${maven-failsafe-plugin-version}</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>integration-test</goal>
                                <goal>verify</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <skipITs>${skipITs}</skipITs>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>buildnumber-maven-plugin</artifactId>
                    <version>${maven-buildnumber-plugin-version}</version>
                    <executions>
                        <execution>
                            <phase>validate</phase>
                            <goals>
                                <goal>create</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <getRevisionOnlyOnce>true</getRevisionOnlyOnce>
                        <shortRevisionLength>8</shortRevisionLength>
                        <timestampFormat>{0,date,yyyyMMdd-HHmmss}</timestampFormat>
                        <attach>true</attach>
                        <addOutputDirectoryToResources>true</addOutputDirectoryToResources>
                        <doCheck>false</doCheck>
                        <doUpdate>false</doUpdate>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${maven-jar-plugin-version}</version>
                    <configuration>
                        <archive>
                            <manifestEntries>
                                <Build-Time>${maven.build.timestamp}</Build-Time>
                            </manifestEntries>
                            <manifestSections>
                                <manifestSection>
                                    <name>Implementation</name>
                                    <manifestEntries>
                                        <Implementation-Title>${project.name}</Implementation-Title>
                                        <Implementation-Vendor>IBM Corporation</Implementation-Vendor>
                                        <Implementation-Version>${project.version}</Implementation-Version>
                                        <Implementation-SCM-Revision>${buildNumber}</Implementation-SCM-Revision>
                                        <Implementation-SCM-Branch>${scmBranch}</Implementation-SCM-Branch>
                                    </manifestEntries>
                                </manifestSection>
                            </manifestSections>
                        </archive>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <!-- Note deploy plugin configuration via profile -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <aggregate>true</aggregate>
                    <show>public</show>
                    <source>1.8</source>
                    <doctitle>${project.name}, version ${project.version}</doctitle>
                </configuration>
                <executions>
                    <execution>
                        <id>aggregate</id>
                        <goals>
                            <goal>aggregate</goal>
                        </goals>
                        <phase>package</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${surefire-version}</version>
                <configuration>
                    <skipTests>${skip.unit.tests}</skipTests>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>buildnumber-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven-javadoc-plugin-version}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>${maven-reports-plugin-version}</version>
                <reportSets>
                    <reportSet></reportSet>
                </reportSets>
            </plugin>
        </plugins>
    </reporting>

    <developers>
        <developer>
            <name>IBM Cloudant</name>
            <email>cldtsdks@us.ibm.com</email>
            <url>https://www.ibm.com/cloud/cloudant</url>
        </developer>
    </developers>

</project>
