<?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.sts</groupId>
    <artifactId>secure-token-service</artifactId>
    <version>1.2.4</version>
    <packaging>pom</packaging>

    <name>SecureTokenService</name>
    <url>https://github.com/adorsys/secure-token-service</url>
    <description>SecureTokenService modules</description>

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

    <developers>
        <developer>
            <name>Boris Skert</name>
            <email>bsk@adorsys.de</email>
            <organization>adorsys</organization>
            <organizationUrl>https://adorsys.de/</organizationUrl>
        </developer>
        <developer>
            <name>Francis Pouatcha</name>
            <email>fpo@adorsys.de</email>
            <organization>adorsys</organization>
            <organizationUrl>https://adorsys.de/</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:https://git.adorsys.de/adorsys/secure-token-service.git</connection>
        <developerConnection>scm:git:git@github.com:adorsys/secure-token-service.git</developerConnection>
        <url>git@github.com:adorsys/secure-token-service.git</url>
        <tag>HEAD</tag>
    </scm>

    <properties>
        <java.version>17</java.version>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>
        <maven.build.timestamp.format>yyyy-MM-dd HH:mm:ssZZ</maven.build.timestamp.format>
        <maven.build-timestamp>${maven.build.timestamp}</maven.build-timestamp>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <spring-boot.version>3.3.4</spring-boot.version>
        <keystore-management.version>0.0.11</keystore-management.version>
        <shedlock.version>5.3.0</shedlock.version>
        <openapi.version>2.5.0</openapi.version>
        <swagger-annotations.version>2.2.22</swagger-annotations.version>
        <jackson.version>2.17.1</jackson.version>
        <jackson-databind.version>2.17.1</jackson-databind.version>
        <surefire.version>3.2.5</surefire.version>
        <failsafe.version>3.2.5</failsafe.version>
        <jacoco.version>0.8.12</jacoco.version>
        <testcontainers.version>1.19.7</testcontainers.version>
        <flyway.version>10.10.0</flyway.version>
        <postgres.version>42.7.3</postgres.version>
        <h2.version>2.2.224</h2.version>
        <mockito.version>5.12.0</mockito.version>
        <catch-exception.version>2.0</catch-exception.version>
        <nimbus-jose-jwt.version>9.37.3</nimbus-jose-jwt.version>
        <scmBranch/>
        <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.2</maven-deploy-plugin.version>
        <maven-gpg-plugin.version>3.2.4</maven-gpg-plugin.version>
        <maven-javadoc-plugin.version>3.7.0</maven-javadoc-plugin.version>
        <maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
        <lombok.version>1.18.32</lombok.version>
        <lombok-maven-plugin.version>1.18.20.0</lombok-maven-plugin.version>
    </properties>

    <modules>
        <module>sts-common</module>
        <module>sts-pop</module>
        <module>sts-token</module>
        <module>sts-server-info</module>
        <module>sts-token-auth</module>
        <module>sts-resource-server</module>
        <module>sts-example</module>
        <module>sts-keymanagement</module>
        <module>sts-spring</module>
        <module>sts-service-component-example</module>
        <module>sts-persistence-jpa</module>
        <module>sts-persistence-mongo</module>
        <module>sts-secret-server</module>
        <module>sts-secret</module>
        <module>sts-simple-encryption</module>
        <module>keycloak-storage-provider</module>
        <module>sts-e2e-tests</module>
    </modules>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-core</artifactId>
                <version>${jackson.version}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-annotations</artifactId>
                <version>${jackson.version}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${jackson-databind.version}</version>
            </dependency>
            <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.datatype/jackson-datatype-jakarta-jsonp -->
            <dependency>
                <groupId>com.fasterxml.jackson.datatype</groupId>
                <artifactId>jackson-datatype-jakarta-jsonp</artifactId>
                <version>${jackson-databind.version}</version>
            </dependency>
            <!--https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-build-systems.html#using-boot-maven-without-a-parent -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring-boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>org.springdoc</groupId>
                <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
                <version>${openapi.version}</version>
            </dependency>
            <dependency>
                <groupId>io.swagger.core.v3</groupId>
                <artifactId>swagger-annotations-jakarta</artifactId>
                <version>${swagger-annotations.version}</version>
            </dependency>
            <dependency>
                <groupId>de.adorsys.sts</groupId>
                <artifactId>sts-common</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>de.adorsys.sts</groupId>
                <artifactId>sts-pop</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>de.adorsys.sts</groupId>
                <artifactId>sts-token</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>de.adorsys.sts</groupId>
                <artifactId>sts-token-auth</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>de.adorsys.sts</groupId>
                <artifactId>sts-resource-server</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>de.adorsys.sts</groupId>
                <artifactId>sts-server-info</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>de.adorsys.sts</groupId>
                <artifactId>sts-worksheet-loader</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>de.adorsys.sts</groupId>
                <artifactId>sts-keymanagement</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>de.adorsys.sts</groupId>
                <artifactId>sts-keymanagement-api</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>de.adorsys.sts</groupId>
                <artifactId>sts-keymanagement-impl</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>de.adorsys.sts</groupId>
                <artifactId>sts-spring</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>de.adorsys.sts</groupId>
                <artifactId>sts-persistence-jpa</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>de.adorsys.sts</groupId>
                <artifactId>sts-persistence-mongo</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>de.adorsys.sts</groupId>
                <artifactId>sts-secret</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>de.adorsys.sts</groupId>
                <artifactId>sts-simple-encryption</artifactId>
                <version>${project.version}</version>
            </dependency>

            <dependency>
                <groupId>de.adorsys.keymanagement</groupId>
                <artifactId>api</artifactId>
                <version>${keystore-management.version}</version>
            </dependency>
            <dependency>
                <groupId>de.adorsys.keymanagement</groupId>
                <artifactId>core</artifactId>
                <version>${keystore-management.version}</version>
            </dependency>
            <dependency>
                <groupId>de.adorsys.keymanagement</groupId>
                <artifactId>juggler-bouncycastle</artifactId>
                <version>${keystore-management.version}</version>
            </dependency>

            <dependency>
                <groupId>com.nimbusds</groupId>
                <artifactId>nimbus-jose-jwt</artifactId>
                <version>${nimbus-jose-jwt.version}</version>
            </dependency>

            <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-template</artifactId>
                <version>${shedlock.version}</version>
            </dependency>
            <dependency>
                <groupId>net.javacrumbs.shedlock</groupId>
                <artifactId>shedlock-provider-mongo</artifactId>
                <version>${shedlock.version}</version>
            </dependency>

            <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>3.9</version>
            </dependency>

            <!-- Database -->
            <dependency>
                <groupId>org.flywaydb</groupId>
                <artifactId>flyway-core</artifactId>
                <version>${flyway.version}</version>
                <scope>runtime</scope>
            </dependency>
            <dependency>
                <groupId>org.flywaydb</groupId>
                <artifactId>flyway-database-postgresql</artifactId>
                <version>${flyway.version}</version>
                <scope>runtime</scope>
            </dependency>
            <dependency>
                <groupId>org.flywaydb</groupId>
                <artifactId>flyway-mysql</artifactId>
                <version>${flyway.version}</version>
                <scope>runtime</scope>
            </dependency>
            <dependency>
                <groupId>org.postgresql</groupId>
                <artifactId>postgresql</artifactId>
                <version>${postgres.version}</version>
                <scope>runtime</scope>
            </dependency>
            <dependency>
                <groupId>com.h2database</groupId>
                <artifactId>h2</artifactId>
                <version>${h2.version}</version>
                <scope>runtime</scope>
            </dependency>

            <!-- Testing Libraries -->
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>${mockito.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>eu.codearte.catch-exception</groupId>
                <artifactId>catch-exception</artifactId>
                <version>${catch-exception.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.testcontainers</groupId>
                <artifactId>testcontainers</artifactId>
                <version>${testcontainers.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.testcontainers</groupId>
                <artifactId>junit-jupiter</artifactId>
                <version>${testcontainers.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>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <version>${spring-boot.version}</version>
                <scope>test</scope>
            </dependency>
        </dependencies>

    </dependencyManagement>

    <build>
        <finalName>${project.artifactId}</finalName>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>prepare-agent</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>report-aggregate</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>report-aggregate</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <append>true</append>
                    <propertyName>surefireArgLine</propertyName>
                </configuration>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-project-info-reports-plugin</artifactId>
                    <version>2.7</version>
                </plugin>
                <!-- For Junit5 -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${surefire.version}</version>
                    <configuration>
                        <!--suppress UnresolvedMavenProperty -->
                        <argLine>${surefireArgLine}</argLine>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${jacoco.version}</version>
                </plugin>

                <!-- Maven Release Build fails if javadoc comments are invalid. http://stackoverflow.com/questions/15886209/maven-is-not-working-in-java-8-when-javadoc-tags-are-incomplete -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${maven-javadoc-plugin.version}</version>
                    <configuration>
                        <charset>${project.build.sourceEncoding}</charset>
                        <encoding>${project.build.sourceEncoding}</encoding>
                        <docencoding>${project.build.sourceEncoding}</docencoding>
                        <doclint>none</doclint>
                    </configuration>
                </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-compiler-plugin</artifactId>
                    <version>${maven-compiler-plugin.version}</version>
                </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>
                                <!--suppress UnresolvedMavenProperty -->
                                <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.projectlombok</groupId>
                    <artifactId>lombok-maven-plugin</artifactId>
                    <version>${lombok-maven-plugin.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-deploy-plugin</artifactId>
                        <version>${maven-deploy-plugin.version}</version>
                        <configuration>
                            <deployAtEnd>true</deployAtEnd>
                        </configuration>
                    </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>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.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>
                                    <outputDirectory>${project.build.directory}/delombok</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${maven-javadoc-plugin.version}</version>
                        <configuration>
                            <source>17</source>
                            <doclint>none</doclint>
                            <sourcepath>${project.build.directory}/delombok</sourcepath>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </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>
