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

  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>3.3.1</version>
    <relativePath/> <!-- lookup parent from repository -->
  </parent>

  <groupId>de.gematik.idp</groupId>
  <artifactId>idp-global</artifactId>
  <version>28.0.2</version>
  <packaging>pom</packaging>

  <description>IDP</description>

  <organization>
    <name>gematik GmbH</name>
    <url>http://www.gematik.de</url>
  </organization>

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

  <developers>
    <developer>
      <name>gematik</name>
      <email>software-development@gematik.de</email>
      <url>https://gematik.github.io/</url>
      <organization>gematik GmbH</organization>
      <organizationUrl>https://www.gematik.de/</organizationUrl>
    </developer>
  </developers>

  <modules>
    <module>idp-crypto</module>
    <module>idp-test</module>
    <module>idp-commons</module>
    <module>idp-client</module>
    <module>idp-sektoral</module>
    <module>idp-server</module>
    <module>idp-testsuite</module>
    <module>idp-report</module>
  </modules>


  <scm>
    <connection>scm:git:git://github.com/gematik/ref-idp-server.git</connection>
    <developerConnection>scm:git:ssh://git@github.com:gematik/ref-idp-server.git
    </developerConnection>
    <url>https://github.com/gematik/ref-idp-server</url>
  </scm>


  <issueManagement>
    <system>GitHub</system>
    <url>https://github.com/gematik/ref-idp-server/issues</url>
  </issueManagement>

  <properties>

    <docker.registry.gematik>local</docker.registry.gematik>
    <docker.image.name.smartcard>${docker.registry.gematik}/idm/idp-server
    </docker.image.name.smartcard>
    <docker.image.name.sektoralidp>${docker.registry.gematik}/idm/idp-sektoral
    </docker.image.name.sektoralidp>
    <docker.image.name.fachdienst>${docker.registry.gematik}/idp/idp-fachdienst
    </docker.image.name.fachdienst>
    <version.java>17</version.java>
    <mpir.skip>true</mpir.skip>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    <sonar.coverage.jacoco.xmlReportPaths>
      ${project.basedir}/../idp-report/target/site/jacoco-aggregate/jacoco.xml
    </sonar.coverage.jacoco.xmlReportPaths>
    <sonar.dependencyCheck.htmlReportPath>${project.basedir}/target/dependency-check-report.html
    </sonar.dependencyCheck.htmlReportPath>
    <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
    <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
    <sonar.language>java</sonar.language>

    <version.bouncycastle.bcpkix>1.78.1</version.bouncycastle.bcpkix>
    <version.commons-io>2.16.1</version.commons-io>
    <version.commons-lang3>3.14.0</version.commons-lang3>
    <version.gemLibPki>2.1.4</version.gemLibPki>
    <version.h2>2.2.224</version.h2>
    <version.json>20240303</version.json>
    <version.plexus-utils>3.4.2</version.plexus-utils>
    <version.rest-assured>5.4.0</version.rest-assured>
    <version.serenity.core>3.2.4</version.serenity.core>
    <version.unirest>4.4.0</version.unirest>

    <version.build-helper-maven-plugin>3.6.0</version.build-helper-maven-plugin>
    <version.docker-maven-plugin>0.44.0</version.docker-maven-plugin>
    <version.copy-rename-maven-plugin>1.0.1</version.copy-rename-maven-plugin>
    <version.jacoco-maven-plugin>0.8.12</version.jacoco-maven-plugin>
    <version.jakarta.ws.rs-api>4.0.0</version.jakarta.ws.rs-api>
    <version.log4j2>2.23.1</version.log4j2>
    <version.maven>3.8.6</version.maven>
    <version.maven-clean-plugin>3.4.0</version.maven-clean-plugin>
    <version.maven-compiler-plugin>3.13.0</version.maven-compiler-plugin>
    <!-- Overwrite Version from Parent -->
    <maven-deploy-plugin.version>3.1.2</maven-deploy-plugin.version>
    <version.maven-enforcer-plugin>3.5.0</version.maven-enforcer-plugin>
    <version.maven-failsafe-plugin>3.3.0</version.maven-failsafe-plugin>
    <version.maven-gpg-plugin>3.2.4</version.maven-gpg-plugin>
    <version.maven-jar-plugin>3.4.1</version.maven-jar-plugin>
    <version.maven-javadoc-plugin>3.7.0</version.maven-javadoc-plugin>
    <version.maven-project-info-reports-plugin>3.6.0</version.maven-project-info-reports-plugin>
    <!-- only needed for mvn site to avoid stack traces flooding the console -->
    <version.maven-resources-plugin>3.3.1</version.maven-resources-plugin>
    <version.maven-site-plugin>3.12.1</version.maven-site-plugin>
    <!-- settings for upload to sonar server -->
    <version.maven-source-plugin>3.3.1</version.maven-source-plugin>
    <version.maven-surefire-plugin>3.3.0</version.maven-surefire-plugin>
    <version.nexus-staging-maven-plugin>1.7.0</version.nexus-staging-maven-plugin>
    <version.slf4j-api>2.0.13</version.slf4j-api>
    <version.sonar-maven-plugin>4.0.0.4121</version.sonar-maven-plugin>
    <version.spotless-maven-plugin>2.43.0</version.spotless-maven-plugin>
    <version.spotless.google-java-format>1.15.0</version.spotless.google-java-format>
    <version.spring-boot-maven-plugin>3.3.1</version.spring-boot-maven-plugin>
    <yarnAuditAnalyzerEnabled>false</yarnAuditAnalyzerEnabled>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.bouncycastle</groupId>
        <artifactId>bcpkix-jdk18on</artifactId>
        <version>${version.bouncycastle.bcpkix}</version>
      </dependency>
      <dependency>
        <groupId>de.gematik.pki</groupId>
        <artifactId>gemLibPki</artifactId>
        <version>${version.gemLibPki}</version>
      </dependency>
      <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>${version.json}</version>
      </dependency>
      <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <version>${version.h2}</version>
      </dependency>
      <dependency>
        <groupId>com.konghq</groupId>
        <artifactId>unirest-java-core</artifactId>
        <version>${version.unirest}</version>
      </dependency>
      <dependency>
        <groupId>com.konghq</groupId>
        <artifactId>unirest-objectmapper-jackson</artifactId>
        <version>${version.unirest}</version>
      </dependency>
      <!-- https://mvnrepository.com/artifact/jakarta.ws.rs/jakarta.ws.rs-api -->
      <dependency>
        <groupId>jakarta.ws.rs</groupId>
        <artifactId>jakarta.ws.rs-api</artifactId>
        <version>${version.jakarta.ws.rs-api}</version>
      </dependency>
      <!-- exclude logback -->
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter</artifactId>
        <exclusions>
          <exclusion>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-logging</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-api</artifactId>
        <version>${version.log4j2}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
        <version>${version.log4j2}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-slf4j2-impl</artifactId>
        <version>${version.log4j2}</version>
      </dependency><!-- https://mvnrepository.com/artifact/com.konghq/unirest-objectmapper-jackson -->
      <dependency>
        <groupId>com.konghq</groupId>
        <artifactId>unirest-objectmapper-jackson</artifactId>
        <version>4.2.9</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-resources-plugin</artifactId>
          <version>${version.maven-resources-plugin}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>${version.maven-compiler-plugin}</version>
          <configuration>
            <encoding>${project.build.sourceEncoding}</encoding>
            <source>${version.java}</source>
            <target>${version.java}</target>
            <debug>true</debug>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>${version.maven-enforcer-plugin}</version>
        <executions>
          <execution>
            <id>enforce-versions</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireMavenVersion>
                  <message>Maven version should be ${version.maven} at least.</message>
                  <version>${version.maven}</version>
                </requireMavenVersion>
                <requireJavaVersion>
                  <message>Java version should be ${version.java}.</message>
                  <version>${version.java}</version>
                </requireJavaVersion>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!-- Phase clean -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-clean-plugin</artifactId>
        <version>${version.maven-clean-plugin}</version>
        <configuration>
          <filesets>
            <!-- delete logfiles -->
            <fileset>
              <directory>logs</directory>
              <includes>
                <include>**/*</include>
              </includes>
              <followSymlinks>false</followSymlinks>
            </fileset>
          </filesets>
        </configuration>
      </plugin>
      <!-- remove only needed for mvn site runs -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <version>${version.maven-site-plugin}</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <version>${version.maven-project-info-reports-plugin}</version>
      </plugin>
      <!-- to remove docker images call mvn docker:remove -Ddocker.removeNamePattern=idp-* -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${version.maven-surefire-plugin}</version>
        <configuration>
          <argLine>${surefireArgLine} -Dfile.encoding=UTF-8</argLine>
          <skipTests>${skip.unittests}</skipTests>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${version.jacoco-maven-plugin}</version>
        <executions>
          <execution>
            <id>default-prepare-agent</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
            <configuration>
              <propertyName>surefireArgLine</propertyName>
              <append>true</append>
              <destFile>${project.basedir}/target/jacoco.exec</destFile>
              <excludes>
                <exclude>de.gematik.idp.tests.*</exclude>
              </excludes>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- to upload jacoco results to sonar server via mvn sonar:sonar-->
      <plugin>
        <groupId>org.sonarsource.scanner.maven</groupId>
        <artifactId>sonar-maven-plugin</artifactId>
        <version>${version.sonar-maven-plugin}</version>
      </plugin>
      <plugin>
        <groupId>com.diffplug.spotless</groupId>
        <artifactId>spotless-maven-plugin</artifactId>
        <version>${version.spotless-maven-plugin}</version>
        <configuration>
          <formats>
            <!-- you can define as many formats as you want, each is independent -->
            <format>
              <!-- define the files to apply to -->
              <includes>
                <include>**/*.yml</include>
              </includes>
              <excludes>
                <exclude>**/target/**/*</exclude>
              </excludes>
              <!-- define the steps to apply to those files -->
              <trimTrailingWhitespace/>
              <endWithNewline/>
              <indent>
                <spaces>true</spaces>
                <spacesPerTab>2</spacesPerTab>
              </indent>
            </format>
          </formats>

          <java>
            <toggleOffOn/>
            <googleJavaFormat>
              <version>${version.spotless.google-java-format}</version>
              <style>GOOGLE</style>
              <reflowLongStrings>true</reflowLongStrings>
            </googleJavaFormat>
          </java>
          <groovy>
            <includes>
              <include>**/*.Jenkinsfile</include>
            </includes>
            <importOrder/>
          </groovy>
          <markdown>
            <includes>
              <include>**/*.md</include>
            </includes>
            <excludes>
              <exclude>**/target/**/*</exclude>
            </excludes>
          </markdown>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>external</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>${version.maven-gpg-plugin}</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <goals>
                  <goal>sign</goal>
                </goals>
                <phase>verify</phase>
                <configuration>
                  <gpgArguments>
                    <arg>--pinentry-mode</arg>
                    <arg>loopback</arg>
                  </gpgArguments>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>${version.nexus-staging-maven-plugin}</version>
            <extensions>true</extensions>
            <configuration>
              <serverId>ossrh</serverId>
              <nexusUrl>https://oss.sonatype.org/</nexusUrl>
              <autoReleaseAfterClose>true</autoReleaseAfterClose>
              <stagingProgressTimeoutMinutes>20</stagingProgressTimeoutMinutes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
