<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>de.gematik.smartcards</groupId>
  <artifactId>lib-smartcards</artifactId>
  <version>1.0.3</version>
  <packaging>pom</packaging>
  <name>lib-smartcards</name>
  <description>lib-smartcards</description>
  <url>https://github.com/gematik/lib-smartcards</url>

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

  <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>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>de.gematik.smartcards.utils</module>
    <module>de.gematik.smartcards.tlv</module>
    <module>de.gematik.smartcards.crypto</module>
    <module>de.gematik.smartcards.sdcom</module>
    <module>de.gematik.smartcards.pcsc</module>
    <module>de.gematik.smartcards.g2icc</module>
  </modules>

  <scm>
    <connection>scm:git:git://github.com/gematik/lib-smartcards.git</connection>
    <developerConnection>scm:git:ssh://git@github.com:gematik/lib-smartcards.git</developerConnection>
    <url>https://github.com/gematik/lib-smartcards</url>
  </scm>

  <properties>
    <java.version>21</java.version>
    <project.build.outputTimestamp>2025-06-19T05:51:07Z</project.build.outputTimestamp>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <sonar.coverage.jacoco.xmlReportPaths>${project.basedir}/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>
    <sonar.exclusions>**/module-info.java</sonar.exclusions>
    <version.jacoco-maven-plugin>0.8.12</version.jacoco-maven-plugin>
    <version.bouncycastle.bcprov>1.81</version.bouncycastle.bcprov>
    <version.central-publishing-maven-plugin>0.7.0</version.central-publishing-maven-plugin>
    <version.ch.qos.logback.logback>1.5.18</version.ch.qos.logback.logback>

    <version.maven-gpg-plugin>3.2.7</version.maven-gpg-plugin>
    <version.junit-jupiter>5.13.1</version.junit-jupiter>
    <version.maven-compiler-plugin>3.13.0</version.maven-compiler-plugin>
    <version.maven-javadoc-plugin>3.10.0</version.maven-javadoc-plugin>
    <version.maven-source-plugin>3.3.1</version.maven-source-plugin>
    <version.maven-surefire-plugin>3.5.0</version.maven-surefire-plugin>
    <version.net.java.dev.jna>5.17.0</version.net.java.dev.jna>
    <version.slf4j-api>2.0.17</version.slf4j-api>
    <version.sonar-maven-plugin>4.0.0.4121</version.sonar-maven-plugin>
    <version.spotbugs-annotations>4.9.3</version.spotbugs-annotations>
    <!-- https://mvnrepository.com/artifact/com.diffplug.spotless/spotless-maven-plugin -->
    <version.spotless-maven-plugin>2.44.5</version.spotless-maven-plugin>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>${version.ch.qos.logback.logback}</version>
      </dependency>
      <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-core</artifactId>
        <version>${version.ch.qos.logback.logback}</version>
      </dependency>
      <dependency>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-annotations</artifactId>
        <version>${version.spotbugs-annotations}</version>
        <scope>compile</scope>
      </dependency>
      <dependency>
        <groupId>de.gematik.smartcards</groupId>
        <artifactId>de.gematik.smartcards.crypto</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>de.gematik.smartcards</groupId>
        <artifactId>de.gematik.smartcards.pcsc</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>de.gematik.smartcards</groupId>
        <artifactId>de.gematik.smartcards.sdcom</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>de.gematik.smartcards</groupId>
        <artifactId>de.gematik.smartcards.tlv</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>de.gematik.smartcards</groupId>
        <artifactId>de.gematik.smartcards.utils</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>net.java.dev.jna</groupId>
        <artifactId>jna</artifactId>
        <version>${version.net.java.dev.jna}</version>
      </dependency>
      <dependency>
        <groupId>org.bouncycastle</groupId>
        <artifactId>bcprov-jdk18on</artifactId>
        <version>${version.bouncycastle.bcprov}</version>
      </dependency>
      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter</artifactId>
        <version>${version.junit-jupiter}</version>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${version.slf4j-api}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <plugins>
        <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>${java.version}</source>
            <target>${java.version}</target>
            <debug>true</debug>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>com.diffplug.spotless</groupId>
        <artifactId>spotless-maven-plugin</artifactId>
        <version>${version.spotless-maven-plugin}</version>
        <configuration>
          <!-- <ratchetFrom>origin/main</ratchetFrom> -->
          <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>
          <pom>
            <includes>
              <include>pom.xml</include>
            </includes>
            <sortPom>
              <encoding>UTF-8</encoding>
              <expandEmptyElements>false</expandEmptyElements>
              <nrOfIndentSpace>2</nrOfIndentSpace>
              <predefinedSortOrder>recommended_2008_06</predefinedSortOrder>
            </sortPom>
          </pom>
          <java>
            <toggleOffOn/>
            <googleJavaFormat/>
            <importOrder/>
            <formatAnnotations/>
            <licenseHeader>
              <file>COPYRIGHT</file>
            </licenseHeader>
          </java>
          <groovy>
            <includes>
              <include>**/*.Jenkinsfile</include>
            </includes>
            <importOrder/>
          </groovy>
          <markdown>
            <includes>
              <include>**/*.md</include>
            </includes>
            <excludes>
              <exclude>**/target/**/*</exclude>
            </excludes>
          </markdown>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${version.maven-surefire-plugin}</version>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${version.jacoco-maven-plugin}</version>
        <executions>
          <execution>
            <id>prepare-agent</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <!-- Merge the .exec files from multiple modules -->
          <execution>
            <id>merge</id>
            <goals>
              <goal>merge</goal>
            </goals>
            <phase>verify</phase>
            <configuration>
              <destFile>${project.build.directory}/jacoco-merged.exec</destFile>
              <fileSets>
                <fileSet>
                  <directory>${project.build.directory}</directory>
                  <includes>
                    <include>jacoco.exec</include>
                  </includes>
                </fileSet>
              </fileSets>
            </configuration>
          </execution>
          <!-- Generate report after tests -->
          <execution>
            <id>report</id>
            <goals>
              <goal>report</goal>
            </goals>
            <phase>verify</phase>
          </execution>
          <!-- Generate the aggregate report -->
          <execution>
            <id>generate-aggregate-report</id>
            <goals>
              <goal>report</goal>
            </goals>
            <phase>verify</phase>
            <configuration>
              <dataFile>${project.build.directory}/jacoco-merged.exec</dataFile>
              <outputDirectory>${project.build.directory}/site/jacoco-aggregate</outputDirectory>
            </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>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>${version.maven-source-plugin}</version>
        <executions>
          <execution>
            <id>attach-sources</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>${version.maven-javadoc-plugin}</version>
        <configuration>
          <doclint>none</doclint>
        </configuration>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </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.central</groupId>
            <artifactId>central-publishing-maven-plugin</artifactId>
            <version>${version.central-publishing-maven-plugin}</version>
            <extensions>true</extensions>
            <configuration>
              <publishingServerId>central</publishingServerId>
              <autoPublish>true</autoPublish>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
