<?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.muenchen.oss.oai</groupId>
    <artifactId>oai-pmh-spring-boot-starter-parent</artifactId>
    <version>2.2.0</version>
    <name>oai-pmh-spring-boot-starter :: parent</name>
    <url>https://github.com/it-at-m/oai-pmh-spring-boot-starter</url>
    <description>OAI-PMH Spring Boot Starter</description>

    <packaging>pom</packaging>

    <modules>
        <module>oai-pmh-spring-boot-starter</module>
        <module>oai-pmh-schema</module>
    </modules>

    <properties>
        <java.version>21</java.version>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>
        <maven.compiler.release>${java.version}</maven.compiler.release>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <spring.boot.version>3.5.0</spring.boot.version>
        <logstash.encoder>8.1</logstash.encoder>
        <!-- SonarQube -->
        <sonar.scanner.version>5.1.0.4751</sonar.scanner.version>
        <!-- TestCoverage -->
        <jacoco.version>0.8.13</jacoco.version>
        <!-- Plugins -->
        <maven-scm-plugin.version>2.1.0</maven-scm-plugin.version>
        <maven-surefire-plugin.version>3.5.3</maven-surefire-plugin.version>
        <maven.compiler.plugin.version>3.14.0</maven.compiler.plugin.version>
        <!-- Version muss mit der in den spring-boot-dependencies bereitgestellten Lombok-Version übereinstimmen -->
        <org.projectlombok.lombok.version>1.18.38</org.projectlombok.lombok.version>
        <ojdbc10.version>19.21.0.0</ojdbc10.version>
        <jakarta.persistence-api.version>3.1.0</jakarta.persistence-api.version>
        <!-- Update to > 2.34.0 currently not possible. For more details see https://github.com/diffplug/spotless/issues/1658 -->
        <spotless-maven-plugin.version>2.44.5</spotless-maven-plugin.version>
        <itm-java-codeformat.version>1.0.10</itm-java-codeformat.version>
        <!--
          The depclean-maven-plugin version 2.0.6 uses the ASM Library version 9.4,
          which currently only supports Java 20. To ensure compatibility with the latest Java version,
          i have upgraded the ASM dependencies within the depclean-maven-plugin to version 9.7.

          https://github.com/ASSERT-KTH/depclean/issues/278
        -->
        <depclean-maven-plugin.version>2.1.0</depclean-maven-plugin.version>
        <sonar.coverage.jacoco.xmlReportPaths>reportmodule/target/site/jacoco-aggregate/jacoco.xml
        </sonar.coverage.jacoco.xmlReportPaths>
    </properties>


    <dependencyManagement>
        <dependencies>
            <dependency>
                <!-- Import dependency management from Spring Boot -->
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring.boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>


    <dependencies>

        <!-- Spring developer tools -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
        </dependency>

        <!-- Logging -->
        <dependency>
            <groupId>net.logstash.logback</groupId>
            <artifactId>logstash-logback-encoder</artifactId>
            <version>${logstash.encoder}</version>
        </dependency>

        <!-- Testing -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>


    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.plugin.version}</version>
                <configuration>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                            <version>${org.projectlombok.lombok.version}</version>
                        </path>
                    </annotationProcessorPaths>
                    <compilerArgs>
                        <compilerArg>-parameters</compilerArg>
                    </compilerArgs>
                    <release>${java.version}</release>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-scm-plugin</artifactId>
                <version>${maven-scm-plugin.version}</version>
                <configuration>
                    <tag>RT-REL-${project.version}</tag>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <!-- Sets the VM argument line used when unit tests are run. -->
                            <propertyName>surefireArgLine</propertyName>
                        </configuration>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <excludes>
                        <exclude>
                            **/de/muenchen/itm/munichmetahub/datamapper/database/adis/schema/catalog/tables/*
                        </exclude>
                        <exclude>
                            **/de/muenchen/itm/munichmetahub/oai-pmh-schema/*
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin.version}</version>
                <configuration>
                    <!--suppress UnresolvedMavenProperty -->
                    <argLine>${surefireArgLine} -Dfile.encoding=${project.build.sourceEncoding}</argLine>
                </configuration>
                <executions>
                    <execution>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <excludes>
                                <exclude>none</exclude>
                            </excludes>
                            <includes>
                                <include>**/*IT</include>
                            </includes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.sonarsource.scanner.maven</groupId>
                <artifactId>sonar-maven-plugin</artifactId>
                <version>${sonar.scanner.version}</version>
            </plugin>

            <!-- Codeformatter Spotless -->
            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>${spotless-maven-plugin.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>de.muenchen.oss</groupId>
                        <artifactId>itm-java-codeformat</artifactId>
                        <version>${itm-java-codeformat.version}</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <java>
                        <includes>
                            <include>**/src/main/java/**/*.java</include> <!-- Check application code -->
                            <include>**/src/main/java/**/*.java</include> <!-- Check application tests code -->
                        </includes>
                        <excludes>
                            <exclude>**/src/main/java/**/RdadtrMaps.java</exclude>
                        </excludes>
                        <eclipse>
                            <file>itm-java-codeformat/java_codestyle_formatter.xml</file>
                        </eclipse>
                        <trimTrailingWhitespace />
                        <endWithNewline />
                    </java>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!--
              The depclean-maven-plugin version 2.0.6 uses the ASM Library version 9.4,
              which currently only supports Java 20. To ensure compatibility with the latest Java version,
              i have upgraded the ASM dependencies within the depclean-maven-plugin to version 9.7.

              https://github.com/ASSERT-KTH/depclean/issues/278
            -->
            <plugin>
                <groupId>se.kth.castor</groupId>
                <artifactId>depclean-maven-plugin</artifactId>
                <version>${depclean-maven-plugin.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>org.ow2.asm</groupId>
                        <artifactId>asm-util</artifactId>
                        <version>9.8</version>
                    </dependency>
                    <dependency>
                        <groupId>org.ow2.asm</groupId>
                        <artifactId>asm-tree</artifactId>
                        <version>9.8</version>
                    </dependency>
                    <dependency>
                        <groupId>org.ow2.asm</groupId>
                        <artifactId>asm-commons</artifactId>
                        <version>9.8</version>
                    </dependency>
                    <dependency>
                        <groupId>org.ow2.asm</groupId>
                        <artifactId>asm</artifactId>
                        <version>9.8</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <failIfUnusedDirect>true</failIfUnusedDirect>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <configuration>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <useReleaseProfile>false</useReleaseProfile>
                    <releaseProfiles>release</releaseProfiles>
                    <goals>deploy</goals>
                    <tagNameFormat>@{project.version}</tagNameFormat>
                    <scmCommentPrefix>:bookmark: [maven-release-plugin]</scmCommentPrefix>
                </configuration>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>3.1.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>3.2.7</version>
                </plugin>
                <plugin>
                    <groupId>org.sonatype.central</groupId>
                    <artifactId>central-publishing-maven-plugin</artifactId>
                    <version>0.7.0</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <!-- Central Portal Publishing Plugin -->
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <extensions>true</extensions>
                        <configuration>
                            <tokenAuth>true</tokenAuth>
                            <autoPublish>true</autoPublish>
                            <deploymentName>${project.groupId}:${project.artifactId}:${project.version}</deploymentName>
                        </configuration>
                    </plugin>
                    <!-- GPG plugin -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <configuration>
                            <skip>${skipGpg}</skip>
                        </configuration>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <!-- Prevent `gpg` from using pinentry programs -->
                                    <gpgArguments>
                                        <arg>--pinentry-mode</arg>
                                        <arg>loopback</arg>
                                    </gpgArguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>


    <licenses>
        <license>
            <name>MIT License</name>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Tobias Peslalz</name>
            <organization>Landeshauptstadt München</organization>
            <url>https://github.com/Tobias-Pe</url>
            <roles>
                <role>initiator</role>
            </roles>
        </developer>
        <developer>
            <name>Benedikt Müller</name>
            <organization>Landeshauptstadt München</organization>
            <url>https://github.com/Crystalskulls</url>
            <roles>
                <role>initiator</role>
            </roles>
        </developer>
    </developers>

    <scm>
        <url>https://github.com/it-at-m/oai-pmh-spring-boot-starter</url>
        <connection>scm:git:https://github.com/it-at-m/oai-pmh-spring-boot-starter.git</connection>
        <developerConnection>scm:git:https://github.com/it-at-m/oai-pmh-spring-boot-starter.git</developerConnection>
        <tag>2.2.0</tag>
  </scm>
</project>
