<?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>de.adorsys.keymanagement</groupId>
    <artifactId>keystore-management</artifactId>
    <packaging>pom</packaging>
    <version>0.0.11</version>
    <modules>
        <module>api</module>
        <module>core</module>
        <module>security-provider-adapters</module>
        <module>juggler</module>
        <!-- This is rather foreign module for this repository -->
        <module>extras-keyrotation</module>
    </modules>

    <name>keymanagement</name>
    <description>
        Fluent-API to generate encryption keys and keystores.
        Query-like syntax to read and manipulate keys in keystore.
    </description>
    <url>https://github.com/adorsys/keystore-management</url>
    <scm>
        <connection>scm:git@github.com:adorsys/keystore-management.git</connection>
        <developerConnection>scm:git:git@github.com:adorsys/keystore-management.git</developerConnection>
        <url>git@github.com:adorsys/keystore-management.git</url>
        <tag>HEAD</tag>
    </scm>

    <licenses>
        <license>
            <name>The Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>
    <developers>
        <developer>
            <name>Maksym Hryshchenko</name>
            <email>mhr@adorsys.de</email>
            <organization>adorsys</organization>
            <organizationUrl>https://adorsys.de/</organizationUrl>
        </developer>
        <developer>
            <name>Valentyn Berezin</name>
            <email>vbeex@adorsys.de</email>
            <organization>adorsys</organization>
            <organizationUrl>https://adorsys.de/</organizationUrl>
        </developer>
    </developers>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <deploy.disabled>false</deploy.disabled>
        <lombok-maven-plugin.version>1.18.20.0</lombok-maven-plugin.version>
        <doclint>none</doclint>
        <src.dir>src/main/java</src.dir>
        <test.src.dir>src/test/java</test.src.dir>
        <jacoco.reportPath>${maven.multiModuleProjectDirectory}/target/jacoco.exec</jacoco.reportPath>
        <maven.compiler.plugin.version>3.12.1</maven.compiler.plugin.version>
        <maven.dependency.plugin.version>3.6.1</maven.dependency.plugin.version>
        <lombok.version>1.18.30</lombok.version>
        <bouncycastle.version>1.78.1</bouncycastle.version>
        <dagger.version>2.50</dagger.version>
        <shedlock.version>5.10.2</shedlock.version>
        <mongo.version>4.11.1</mongo.version>
        <cqengine.version>3.6.0</cqengine.version>
        <guava.version>33.0.0-jre</guava.version>
        <slf4j.version>2.0.11</slf4j.version>
        <jupiter.version>5.10.1</jupiter.version>
        <assertj.version>3.25.1</assertj.version>
        <mockito.version>5.9.0</mockito.version>
        <surefire.version>3.2.5</surefire.version>
        <jacoco.version>0.8.11</jacoco.version>
        <gson.version>2.10.1</gson.version>
        <springdoc.version>1.7.0</springdoc.version>
        <nimbus.version>9.37.3</nimbus.version>
        <jsonassert.version>1.5.1</jsonassert.version>
        <testcontainers.version>1.19.3</testcontainers.version>
        <spotbugs.version>4.8.3</spotbugs.version>
        <spotbugs-plugin.version>4.8.3.0</spotbugs-plugin.version>
        <checkstyle-plugin.version>3.3.1</checkstyle-plugin.version>
        <maven-project-info-reports-plugin.version>3.5.0</maven-project-info-reports-plugin.version>
        <nexus-staging-maven-plugin.version>1.6.13</nexus-staging-maven-plugin.version>
        <maven-source-plugin.version>3.3.0</maven-source-plugin.version>
        <maven-release-plugin.version>3.0.1</maven-release-plugin.version>
        <maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
        <buildnumber-maven-plugin.version>3.2.0</buildnumber-maven-plugin.version>
        <maven-deploy-plugin.version>3.1.1</maven-deploy-plugin.version>
        <maven-gpg-plugin.version>3.1.0</maven-gpg-plugin.version>
        <maven-javadoc-plugin.version>3.6.0</maven-javadoc-plugin.version>
        <buildNumber/>
        <scmBranch/>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>${lombok.version}</version>
            </dependency>
            <dependency>
                <groupId>org.bouncycastle</groupId>
                <artifactId>bcpkix-jdk18on</artifactId>
                <version>${bouncycastle.version}</version>
            </dependency>
            <dependency>
                <groupId>org.bouncycastle</groupId>
                <artifactId>bcprov-jdk18on</artifactId>
                <version>${bouncycastle.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.dagger</groupId>
                <artifactId>dagger</artifactId>
                <version>${dagger.version}</version>
            </dependency>
            <dependency>
                <groupId>com.googlecode.cqengine</groupId>
                <artifactId>cqengine</artifactId>
                <version>${cqengine.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>${guava.version}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.code.gson</groupId>
                <artifactId>gson</artifactId>
                <version>${gson.version}</version>
            </dependency>

            <!-- Extras section -->
            <dependency>
                <groupId>net.javacrumbs.shedlock</groupId>
                <artifactId>shedlock-core</artifactId>
                <version>${shedlock.version}</version>
            </dependency>
            <dependency>
                <groupId>net.javacrumbs.shedlock</groupId>
                <artifactId>shedlock-provider-jdbc</artifactId>
                <version>${shedlock.version}</version>
            </dependency>
            <dependency>
                <groupId>net.javacrumbs.shedlock</groupId>
                <artifactId>shedlock-provider-mongo</artifactId>
                <version>${shedlock.version}</version>
            </dependency>
            <dependency>
                <groupId>org.mongodb</groupId>
                <artifactId>mongodb-driver-sync</artifactId>
                <version>${mongo.version}</version>
            </dependency>
            <dependency>
                <groupId>com.nimbusds</groupId>
                <artifactId>nimbus-jose-jwt</artifactId>
                <version>${nimbus.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springdoc</groupId>
                <artifactId>springdoc-openapi-ui</artifactId>
                <version>${springdoc.version}</version>
            </dependency>

            <!-- Test section -->
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter</artifactId>
                <version>${jupiter.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.assertj</groupId>
                <artifactId>assertj-core</artifactId>
                <version>${assertj.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>${mockito.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-simple</artifactId>
                <version>${slf4j.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.skyscreamer</groupId>
                <artifactId>jsonassert</artifactId>
                <version>${jsonassert.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.testcontainers</groupId>
                <artifactId>mysql</artifactId>
                <version>${testcontainers.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.testcontainers</groupId>
                <artifactId>postgresql</artifactId>
                <version>${testcontainers.version}</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>com.github.spotbugs</groupId>
            <artifactId>spotbugs-annotations</artifactId>
            <version>${spotbugs.version}</version>
            <optional>true</optional>
        </dependency>
    </dependencies>

    <build>
        <finalName>${project.artifactId}</finalName>
        <sourceDirectory>${src.dir}</sourceDirectory>
        <testSourceDirectory>${test.src.dir}</testSourceDirectory>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven.compiler.plugin.version}</version>
                    <configuration>
                        <annotationProcessorPaths>
                            <path>
                                <groupId>com.google.dagger</groupId>
                                <artifactId>dagger-compiler</artifactId>
                                <version>${dagger.version}</version>
                            </path>
                            <path>
                                <groupId>org.projectlombok</groupId>
                                <artifactId>lombok</artifactId>
                                <version>${lombok.version}</version>
                            </path>
                        </annotationProcessorPaths>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${surefire.version}</version>
                    <configuration>
                        <argLine>${surefireArgLine}</argLine>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>${maven.dependency.plugin.version}</version>
                    <executions>
                        <execution>
                            <id>analyze</id>
                            <goals>
                                <goal>analyze-only</goal>
                            </goals>
                            <configuration>
                                <failOnWarning>true</failOnWarning>
                                <outputXML>true</outputXML>
                                <ignoredUsedUndeclaredDependencies>
                                    <ignoredUsedUndeclaredDependency>javax.inject:javax.inject
                                    </ignoredUsedUndeclaredDependency>
                                    <ignoredUsedUndeclaredDependency>org.projectlombok:lombok
                                    </ignoredUsedUndeclaredDependency>
                                </ignoredUsedUndeclaredDependencies>
                                <ignoredUnusedDeclaredDependencies>
                                    <ignoredUnusedDeclaredDependency>org.junit.jupiter:junit-jupiter-engine
                                    </ignoredUnusedDeclaredDependency>
                                    <ignoredUnusedDeclaredDependency>org.slf4j:slf4j-simple
                                    </ignoredUnusedDeclaredDependency>
                                    <ignoredUnusedDeclaredDependency>org.mockito:mockito-core
                                    </ignoredUnusedDeclaredDependency>
                                </ignoredUnusedDeclaredDependencies>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${jacoco.version}</version>
                    <executions>
                        <execution>
                            <id>prepare-agent</id>
                            <phase>validate</phase>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>report</id>
                            <phase>test</phase>
                            <goals>
                                <goal>report</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>report-aggregate</id>
                            <phase>package</phase>
                            <goals>
                                <goal>report-aggregate</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <append>true</append>
                        <excludes>
                            <!-- Exclude Dagger2 generated code -->
                            <exclude>**/*_Provide*/**</exclude>
                            <exclude>**/*_Factory*/**</exclude>
                            <exclude>**/*_MembersInjector.class</exclude>
                            <exclude>**/*Dagger*</exclude>
                            <exclude>**/Default*Module.class</exclude>
                            <!-- Exclude RuntimeDelegate -->
                            <exclude>**/*RuntimeDelegatable*</exclude>
                        </excludes>
                        <propertyName>surefireArgLine</propertyName>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>


        <plugins>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
                <version>${spotbugs-plugin.version}</version>
                <configuration>
                    <effort>Max</effort>
                    <threshold>Low</threshold>
                    <xmlOutput>true</xmlOutput>
                    <!-- Java11 triggers issue
                    https://github.com/spotbugs/spotbugs/issues/756
                    that is false positive, excluding it
                    -->
                    <excludeFilterFile>spotbugs-exclude.xml</excludeFilterFile>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>spotbugs</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${checkstyle-plugin.version}</version>
                <configuration>
                    <configLocation>checkstyle.xml</configLocation>
                    <consoleOutput>true</consoleOutput>
                    <failsOnError>false</failsOnError>
<!--                    <failOnViolation>false</failOnViolation>-->
                    <linkXRef>false</linkXRef>
                </configuration>
                <executions>
                    <execution>
                        <id>validate</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <!--
        This profile exist to show Lombok-generated code in javadoc without touching dev and release classes.
        You can generate JavaDoc with comments from lombok using:
        mvn clean javadoc:aggregate -P javadoc
        -->
        <profile>
            <id>javadoc</id>
            <properties>
                <src.dir>target/generated-sources/delombok</src.dir>
                <test.srt.dir>target/generated-test-sources/delombok</test.srt.dir>
            </properties>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <configuration>
                            <annotationProcessorPaths>
                                <path>
                                    <groupId>com.google.dagger</groupId>
                                    <artifactId>dagger-compiler</artifactId>
                                    <version>${dagger.version}</version>
                                </path>
                            </annotationProcessorPaths>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.projectlombok</groupId>
                        <artifactId>lombok-maven-plugin</artifactId>
                        <version>${lombok-maven-plugin.version}</version>
                        <executions>
                            <execution>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>delombok</goal>
                                </goals>
                                <configuration>
                                    <addOutputDirectory>false</addOutputDirectory>
                                    <sourceDirectory>src/main/java</sourceDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${maven-javadoc-plugin.version}</version>
                        <configuration>
                            <!-- Exclude Dagger2 generated code -->
                            <sourceFileExcludes>**/*Dagger*</sourceFileExcludes>
                            <sourceFileExcludes>**/*Factory*</sourceFileExcludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>${nexus-staging-maven-plugin.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>sonatype</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </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-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven-gpg-plugin.version}</version>
                        <configuration>
                        </configuration>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${maven-javadoc-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-project-info-reports-plugin</artifactId>
                            <version>${maven-project-info-reports-plugin.version}</version>
                        </plugin>
                        <plugin>
                            <artifactId>maven-release-plugin</artifactId>
                            <version>${maven-release-plugin.version}</version>
                            <configuration>
                                <releaseProfiles>release</releaseProfiles>
                                <autoVersionSubmodules>true</autoVersionSubmodules>
                            </configuration>
                        </plugin>

                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-jar-plugin</artifactId>
                            <version>${maven-jar-plugin.version}</version>
                            <configuration>
                                <archive>
                                    <manifest>
                                        <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                                        <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                                    </manifest>
                                    <manifestEntries>
                                        <Implementation-Version>${project.version}_${maven.build.timestamp}
                                        </Implementation-Version>
                                        <Project-buildArtifact>${project.artifactId}</Project-buildArtifact>
                                        <Project-buildVersion>${project.version}</Project-buildVersion>
                                        <Project-buildTimestamp>${maven.build.timestamp}</Project-buildTimestamp>
                                        <Project-buildNumber>${buildNumber}</Project-buildNumber>
                                        <Project-buildScmBranch>${scmBranch}</Project-buildScmBranch>
                                    </manifestEntries>
                                </archive>
                            </configuration>
                        </plugin>
                        <plugin>
                            <groupId>org.codehaus.mojo</groupId>
                            <artifactId>buildnumber-maven-plugin</artifactId>
                            <version>${buildnumber-maven-plugin.version}</version>
                            <executions>
                                <execution>
                                    <phase>validate</phase>
                                    <goals>
                                        <goal>create</goal>
                                    </goals>
                                </execution>
                            </executions>
                            <configuration>
                                <!-- Die commit id bei "git log -abbrev-commit" ist ebenfalls 7 Zeichen. -->
                                <shortRevisionLength>7</shortRevisionLength>
                            </configuration>
                        </plugin>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-deploy-plugin</artifactId>
                            <version>${maven-deploy-plugin.version}</version>
                            <configuration>
                                <skip>${deploy.disabled}</skip>
                            </configuration>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>
    </profiles>

    <distributionManagement>
        <repository>
            <id>sonatype</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
        </repository>
        <snapshotRepository>
            <id>sonatype</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>
</project>
