<?xml version="1.0" encoding="UTF-8"?>
<!--


    Copyright 2021-2025 gematik GmbH

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

    *******

    For additional notes and disclaimer from gematik and in case of changes by gematik find details in the "Readme" file.

-->
<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.gematik.test</groupId>
    <artifactId>tiger-mail-extension</artifactId>
    <version>4.2.2</version>
    <packaging>jar</packaging>
    <name>Tiger Mail Extension</name>
    <description>An extension for the Tiger test framework which adds support for monitoring and parsing of email protocols  and email contents (POP, SMTP, MIME).</description>
    <url>https://github.com/gematik/tiger-mail-extension</url>
    <inceptionYear>2021</inceptionYear>

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

    <scm>
        <connection>scm:git:git://github.com/gematik/tiger-mail-extension.git</connection>
        <developerConnection>scm:git:ssh://git@github.com:gematik/tiger-mail-extension.git</developerConnection>
        <url>https://github.com/gematik/tiger-mail-extension</url>
    </scm>

    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/gematik/tiger-mail-extension/issues</url>
    </issueManagement>

    <properties>
        <central-publishing-maven-plugin.version>0.7.0</central-publishing-maven-plugin.version>
        <jacoco-maven-plugin.version>0.8.11</jacoco-maven-plugin.version>
        <maven-compiler-plugin.version>3.14.0</maven-compiler-plugin.version>
        <maven-gpg-plugin.version>3.2.7</maven-gpg-plugin.version>
        <maven-javadoc-plugin.version>3.11.2</maven-javadoc-plugin.version>
        <maven-source-plugin.version>3.3.1</maven-source-plugin.version>
        <maven.compiler.source>${version.java}</maven.compiler.source>
        <maven.compiler.target>${version.java}</maven.compiler.target>
        <mycila.license-maven-plugin.version>5.0.0</mycila.license-maven-plugin.version>
        <project.build.outputEncoding>UTF-8</project.build.outputEncoding>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <skipSurefire>false</skipSurefire>
        <sonar.coverage.jacoco.xmlReportPaths>${project.basedir}/target/site/jacoco-aggregate/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
        <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
        <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
        <sonar.language>java</sonar.language>
        <version.java>17</version.java>
        <version.spotless-maven-plugin>2.44.3</version.spotless-maven-plugin>
        <version.spotless.google-java-format>1.18.1</version.spotless.google-java-format>
        <version.tiger>4.2.2</version.tiger>
        <version.dss>6.2</version.dss>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>de.gematik.test</groupId>
                <artifactId>tiger-bom</artifactId>
                <version>${version.tiger}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>de.gematik.test</groupId>
            <artifactId>tiger-rbel</artifactId>
        </dependency>
        <dependency>
            <groupId>de.gematik.test</groupId>
            <artifactId>tiger-test-lib</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
            <scope>test</scope>
    </dependency>
        <dependency>
            <groupId>eu.europa.ec.joinup.sd-dss</groupId>
            <artifactId>dss-pades-openpdf</artifactId>
            <version>${version.dss}</version>
        </dependency>
        <dependency>
            <groupId>eu.europa.ec.joinup.sd-dss</groupId>
            <artifactId>dss-spi</artifactId>
            <version>${version.dss}</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.icegreen/greenmail-junit5 -->
        <dependency>
            <groupId>com.icegreen</groupId>
            <artifactId>greenmail-junit5</artifactId>
            <version>2.1.5</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <id>jenkins-ci</id>
            <url>https://repo.jenkins-ci.org/releases/</url>
        </repository>
        <repository>
            <id>clojars</id>
            <url>https://clojars.org/repo/</url>
        </repository>
    </repositories>
    <build>
        <plugins>
            <plugin>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok-maven-plugin</artifactId>
                <version>1.18.20.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>delombok</goal>
                        </goals>
                        <phase>generate-sources</phase>
                        <configuration>
                            <addOutputDirectory>false</addOutputDirectory>
                            <sourceDirectory>src/main/java</sourceDirectory>
                            <outputDirectory>${project.build.directory}/delombok</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.8.12</version>
                <executions>
                    <execution>
                        <id>pre-unit-test</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <destFile>${project.build.directory}/coverage-reports/jacoco.exec</destFile>
                            <propertyName>surefireJacocoAgent</propertyName>
                        </configuration>
                    </execution>
                    <execution>
                        <id>pre-integration-test</id>
                        <goals>
                            <goal>prepare-agent-integration</goal>
                        </goals>
                        <configuration>
                            <destFile>${project.build.directory}/coverage-reports/jacoco-it.exec</destFile>
                            <propertyName>failsafeJacocoAgent</propertyName>
                        </configuration>
                    </execution>
                    <execution>
                        <id>post-unit-test</id>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <phase>test</phase>
                        <configuration>
                            <dataFile>${project.build.directory}/coverage-reports/jacoco.exec</dataFile>
                            <outputDirectory>${project.reporting.outputDirectory}/jacoco</outputDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>post-integration-test</id>
                        <goals>
                            <goal>report-integration</goal>
                        </goals>
                        <configuration>
                            <dataFile>${project.build.directory}/coverage-reports/jacoco-it.exec</dataFile>
                            <outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.sonarsource.scanner.maven</groupId>
                <artifactId>sonar-maven-plugin</artifactId>
                <version>5.0.0.4389</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.5.2</version>
                <configuration>
                    <excludes>
                        <exclude>**/*IT.java</exclude>
                    </excludes>
                    <argLine>${surefireJacocoAgent}
                        --add-opens java.base/java.lang=ALL-UNNAMED
                        --add-opens java.base/java.io=ALL-UNNAMED
                        --add-opens java.base/java.util=ALL-UNNAMED
                        -Dfile.encoding=${project.build.sourceEncoding}</argLine>
                    <properties>
                        <property>
                            <name>listener</name>
                            <value>org.sonar.java.jacoco.JUnitListener</value>
                        </property>
                    </properties>
                    <skip>${skipSurefire}</skip>
                </configuration>

            </plugin>

            <!-- Integration tests: run after package so the executable JAR exists -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>3.5.2</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                        <configuration>
                            <includes>
                                <include>**/*IT.java</include>
                            </includes>
                            <argLine>${failsafeJacocoAgent}</argLine>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>${mycila.license-maven-plugin.version}</version>
                <configuration>
                    <licenseSets>
                        <licenseSet>
                            <header>license.header.txt</header>
                            <includes>
                                <include>**/target/**</include>
                                <include>**/src/**</include>
                                <include>**/target/generated-*/**</include>
                            </includes>
                            <excludes>
                                <exclude>**/*.adoc</exclude>
                                <exclude>**/*.properties</exclude>
                                <exclude>**/*.yaml</exclude>
                                <exclude>**/*.yml</exclude>
                                <exclude>**/*.xml</exclude>
                                <exclude>**/*.txt</exclude>
                                <exclude>**/*.cert</exclude>
                                <exclude>**/*.tgr</exclude>
                                <exclude>**/*.mjs</exclude>
                                <exclude>**/*.bks</exclude>
                                <exclude>**/*.crt</exclude>
                                <exclude>**/*.browserslistrc</exclude>
                                <exclude>**/*.factories</exclude>
                                <exclude>**/*.feature</exclude>
                                <exclude>**/*.jtmpl</exclude>
                                <exclude>**/*.ansi</exclude>
                                <exclude>**/*.curl</exclude>
                                <exclude>**/*.map</exclude>
                                <exclude>**/*.env</exclude>
                                <exclude>**/*.pem</exclude>
                                <exclude>**/*.eml</exclude>
                                <exclude>**/*.bin</exclude>
                                <exclude>**/*.b64</exclude>
                                <exclude>**/*.p8</exclude>
                                <exclude>**/*.encrypted</exclude>
                                <exclude>**/*.base64</exclude>
                                <exclude>**/*.pkcs8</exclude>
                                <exclude>**/*.conf</exclude>
                                <exclude>**/*.key</exclude>
                                <exclude>**/dist/assets/*</exclude>
                                <exclude>**/bootstrap.min.css</exclude>
                                <exclude>**/bootstrap.bundle.min.js</exclude>
                            </excludes>
                            <useDefaultExcludes>true</useDefaultExcludes>
                        </licenseSet>
                    </licenseSets>
                    <skipExistingHeaders>true</skipExistingHeaders>
                    <mapping>
                        <vue>XML_STYLE</vue>
                    </mapping>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>com.mycila</groupId>
                        <artifactId>license-maven-plugin-git</artifactId>
                        <!-- make sure you use the same version as license-maven-plugin -->
                        <version>${mycila.license-maven-plugin.version}</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>license headers for sources</id>
                        <goals>
                            <goal>format</goal>
                        </goals>
                        <phase>generate-sources</phase>
                    </execution>
                    <execution>
                        <id>license headers for test sources</id>
                        <goals>
                            <goal>format</goal>
                        </goals>
                        <phase>generate-test-sources</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <encoding>${project.build.sourceEncoding}</encoding>
                    <source>${version.java}</source>
                    <target>${version.java}</target>
                    <debug>true</debug>
                </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</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven-javadoc-plugin.version}</version>
                <configuration>
                    <doclint>none</doclint>
                    <sourcepath>${project.build.directory}/delombok</sourcepath>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>${version.spotless-maven-plugin}</version>
                <configuration>
                    <formats>
                        <format>
                            <includes>
                                <include>**/*.yml</include>
                            </includes>
                            <excludes>
                                <exclude>**/target/**/*</exclude>
                            </excludes>
                            <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>
                    <pom>
                        <sortPom>
                            <expandEmptyElements>false</expandEmptyElements>
                            <sortDependencies>scope,groupId,artifactId</sortDependencies>
                            <sortDependencyExclusions>groupId,artifactId</sortDependencyExclusions>
                            <sortProperties>true</sortProperties>
                            <lineSeparator>\n</lineSeparator>
                            <nrOfIndentSpace>4</nrOfIndentSpace>
                            <indentAttribute>schemaLocation</indentAttribute>
                        </sortPom>
                    </pom>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>external</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven-gpg-plugin.version}</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>${central-publishing-maven-plugin.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                            <autoPublish>true</autoPublish>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
