<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>net.continuous-security-tools</groupId>
    <artifactId>keycloak-auditor</artifactId>
    <version>2.0.10</version>
    <name>Auditing Tooling for Keycloak Server</name>
    <packaging>pom</packaging>

    <description>Please refer to https://github.com/ContinuousSecurityTooling/keycloak-auditor</description>
    <url>https://github.com/ContinuousSecurityTooling/keycloak-auditor</url>

    <modules>
        <module>spi</module>
    </modules>

    <organization>
        <name>Martin Reinhardt</name>
        <url>https://m13t.de/</url>
    </organization>
    <developers>
        <developer>
            <name>Martin Reinhardt</name>
            <email>martin.reinhardt@m13t.de</email>
        </developer>
    </developers>

    <licenses>
        <license>
            <name>MIT</name>
            <comments>s. LICENSE file</comments>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <inceptionYear>2023</inceptionYear>

    <prerequisites>
        <maven>3.0.4</maven>
    </prerequisites>

    <distributionManagement>
        <repository>
            <id>github</id>
            <name>GitHub Packages</name>
            <url>https://maven.pkg.github.com/ContinuousSecurityTooling/keycloak-auditor</url>
        </repository>
    </distributionManagement>


    <issueManagement>
        <url>https://github.com/ContinuousSecurityTooling/keycloak-auditor/issues</url>
        <system>GitHub Issues</system>
    </issueManagement>

    <scm>
        <url>https://${GITHUB_TOKEN}@github.com/ContinuousSecurityTooling/keycloak-auditor.git</url>
        <connection>scm:git:${project.scm.url}</connection>
        <developerConnection>scm:git:${project.scm.url}</developerConnection>
        <tag>v2.0.10</tag>
    </scm>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.build.resourceEncoding>UTF-8</project.build.resourceEncoding>
        <encoding>UTF-8</encoding>
        <surefire.argLine />

        <java.version>17</java.version>

        <sonar.projectKey>ContinuousSecurityTooling_keycloak-auditor</sonar.projectKey>
        <sonar.organization>continuoussecuritytooling</sonar.organization>
        <sonar.host.url>https://sonarcloud.io</sonar.host.url>
        <!-- Point the Sonar Qube Plugin always to the same aggregated JaCoCo report -->
        <sonar.coverage.jacoco.xmlReportPaths>
            ${project.basedir}/../spi/target/site/jacoco/jacoco.xml
        </sonar.coverage.jacoco.xmlReportPaths>

        <!-- logging dependencies -->
        <log4j2.version>2.24.2</log4j2.version>
        <slf4j.version>1.7.33</slf4j.version>

        <!-- dependencies: compile and runtime -->
        <lombok.version>1.18.36</lombok.version>
        <keycloak.version>26.0.7</keycloak.version>
        <resteasy.version>3.15.6.Final</resteasy.version>
        <sun-javax-activation.version>1.2.0</sun-javax-activation.version>
        <javax-activation.version>1.1.1</javax-activation.version>

        <!-- versions of test dependencies -->
        <jacoco.version>0.8.12</jacoco.version>
        <junit5.version>5.10.5</junit5.version>
        <version.hamcrest>3.0</version.hamcrest>
        <hamcrest.version>1.3</hamcrest.version>
        <mockito.version>5.14.2</mockito.version>
        <h2.version>2.3.232</h2.version>

        <!-- plugin versions -->
        <maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
        <maven-javadoc-plugin.version>3.11.1</maven-javadoc-plugin.version>
        <maven-source-plugin.version>3.3.1</maven-source-plugin.version>
        <maven-versions-plugin.version>2.18.0</maven-versions-plugin.version>
        <maven-enforcer-plugin.version>3.5.0</maven-enforcer-plugin.version>
        <maven-ear-plugin.version>3.3.0</maven-ear-plugin.version>
        <animal-sniffer-maven-plugin.version>1.16</animal-sniffer-maven-plugin.version>
        <maven-assembly-plugin.version>2.4</maven-assembly-plugin.version>
        <maven-build-helper-plugin.version>1.9.1</maven-build-helper-plugin.version>
        <maven-bundle-plugin.version>2.5.3</maven-bundle-plugin.version>
        <maven-failsafe-plugin.version>2.18.1</maven-failsafe-plugin.version>
        <maven-processor-plugin.version>2.2.4</maven-processor-plugin.version>
        <maven-surefire-plugin.version>3.5.2</maven-surefire-plugin.version>
        <maven-javadoc-plugin.version>3.11.1</maven-javadoc-plugin.version>
        <plugin.gitflow-maven.version>1.21.0</plugin.gitflow-maven.version>
        <typescript-generator-maven-plugin.version>3.2.1263</typescript-generator-maven-plugin.version>
        <maven-gpg-plugin.version>3.2.7</maven-gpg-plugin.version>
        <nexus-staging-maven-plugin.version>1.7.0</nexus-staging-maven-plugin.version>

    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- base setup dependencies -->
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <scope>provided</scope>
                <version>${lombok.version}</version>
            </dependency>

            <!-- application dependencies -->

            <dependency>
                <groupId>org.keycloak</groupId>
                <artifactId>keycloak-parent</artifactId>
                <version>${keycloak.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>com.sun.activation</groupId>
                <artifactId>javax.activation</artifactId>
                <version>${sun-javax-activation.version}</version>
            </dependency>
            <dependency>
                <groupId>javax.activation</groupId>
                <artifactId>activation</artifactId>
                <version>${javax-activation.version}</version>
            </dependency>

            <!-- logging dependencies -->
            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-core</artifactId>
                <version>${log4j2.version}</version>
                <optional>true</optional>
            </dependency>
            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-api</artifactId>
                <version>${log4j2.version}</version>
                <optional>true</optional>
            </dependency>
            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-slf4j-impl</artifactId>
                <version>${log4j2.version}</version>
                <optional>true</optional>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>2.0.16</version>
            </dependency>

            <!-- test dependencies -->
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-api</artifactId>
                <version>${junit5.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-params</artifactId>
                <version>${junit5.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-engine</artifactId>
                <version>${junit5.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.mockito</groupId>
                <artifactId>mockito-junit-jupiter</artifactId>
                <version>${mockito.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.hamcrest</groupId>
                <artifactId>hamcrest</artifactId>
                <version>${version.hamcrest}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>com.h2database</groupId>
                <artifactId>h2</artifactId>
                <version>${h2.version}</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>

        <!-- test-dependencies -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.junit-pioneer</groupId>
            <artifactId>junit-pioneer</artifactId>
            <version>2.3.0</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <defaultGoal>clean verify</defaultGoal>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin.version}</version>
                <configuration>
                    <threadCount>1</threadCount>
                    <perCoreThreadCount>false</perCoreThreadCount>
                    <argLine>
                        @{surefire.argLine} --add-opens java.base/java.util=ALL-UNNAMED --add-opens
                        java.base/java.lang=ALL-UNNAMED
                    </argLine>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>${maven-enforcer-plugin.version}</version>
                <executions>
                    <execution>
                        <id>enforce</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <rules>
                        <requireMavenVersion>
                            <version>[3.3,)</version>
                        </requireMavenVersion>

                        <requireReleaseDeps>
                            <message>No Snapshots Allowed on release!</message>
                            <onlyWhenRelease>true</onlyWhenRelease>
                        </requireReleaseDeps>

                        <banDuplicatePomDependencyVersions />

                        <dependencyConvergence />
                    </rules>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>versions-maven-plugin</artifactId>
                <version>${maven-versions-plugin.version}</version>
            </plugin>
            <!-- Coverage metering -->
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <propertyName>surefire.argLine</propertyName>
                        </configuration>
                    </execution>
                    <!-- attached to Maven test phase -->
                    <execution>
                        <id>report</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.reporting.outputDirectory}/jacoco</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <profiles>

        <profile>
            <id>central-publish</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>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-release-plugin</artifactId>
                        <version>3.1.1</version>
                        <configuration>
                            <tagNameFormat>v@{project.version}</tagNameFormat>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven-gpg-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <gpgArguments>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                      <groupId>org.sonatype.central</groupId>
                      <artifactId>central-publishing-maven-plugin</artifactId>
                      <version>0.6.0</version>
                      <extensions>true</extensions>
                      <configuration>
                         <publishingServerId>central</publishingServerId>
                         <autoPublish>true</autoPublish>
                      </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
