<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2021,2023 Contributors to the Eclipse Foundation

See the NOTICE file(s) distributed with this work for additional
information regarding copyright ownership.

This program and the accompanying materials are made available under the
terms of the Apache License, Version 2.0 which is available at
https://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.

SPDX-License-Identifier: Apache-2.0
 -->

<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>org.eclipse.tractusx.ssi</groupId>
    <artifactId>cx-ssi-lib</artifactId>
    <version>0.0.18</version>
    <packaging>jar</packaging>

    <!-- required when publishing to Maven Central -->
    <name>cx-ssi-lib</name>
    <description>A library for processing verifiable credentials</description>
    <url>https://github.com/eclipse-tractusx/SSI-agent-lib</url>

    <!-- required when publishing to Maven Central -->
    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

    <!-- required when publishing to Maven Central -->
    <developers>
        <developer>
            <name>Abdulrahman Alkoptan</name>
        </developer>
        <developer>
            <name>Dominik Pinsel</name>
        </developer>
        <developer>
            <name>Boris Rizov</name>
        </developer>
    </developers>

    <!-- required when publishing to Maven Central -->
    <!-- these settings are used by the maven-release-plugin -->
    <!-- docs: https://maven.apache.org/maven-release/maven-release-plugin/usage.html#prepare-your-project-to-use-the-maven-release-plugin -->
    <scm>
        <connection>scm:git:git://github.com/eclipse-tractusx/SSI-agent-lib.git</connection>
        <developerConnection>scm:git:https://github.com/eclipse-tractusx/SSI-agent-lib.git</developerConnection>
        <url>https://github.com/eclipse-tractusx/SSI-agent-lib/tree/main</url>
      <tag>0.0.18</tag>
  </scm>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <delombokSourceDirectory>${project.build.directory}/delombok</delombokSourceDirectory>
        <com.diffplug.spotless.maven.plugin.version>2.41.0</com.diffplug.spotless.maven.plugin.version>
        <org.eclipse.dash.license.tool.plugin.version>1.0.2</org.eclipse.dash.license.tool.plugin.version>
    </properties>

    <dependencies>

        <!-- Project -->
        <!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
            <version>1.18.30</version>
        </dependency>

        <!-- Multibase -->
        <!-- https://mvnrepository.com/artifact/com.github.multiformats/java-multibase -->
        <dependency>
            <groupId>com.github.multiformats</groupId>
            <artifactId>java-multibase</artifactId>
            <version>v1.1.0</version>
        </dependency>

        <!-- Bouncy Castle -->
        <!-- https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk18on -->
        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcprov-jdk18on</artifactId>
            <version>1.77</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.nimbusds/nimbus-jose-jwt -->
        <dependency>
            <groupId>com.nimbusds</groupId>
            <artifactId>nimbus-jose-jwt</artifactId>
            <version>9.37.1</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.apicatalog/titanium-json-ld -->
        <dependency>
            <groupId>com.apicatalog</groupId>
            <artifactId>titanium-json-ld</artifactId>
            <version>1.3.3</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/io.setl/rdf-urdna -->
        <dependency>
            <groupId>io.setl</groupId>
            <artifactId>rdf-urdna</artifactId>
            <version>1.2</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/jakarta.json/jakarta.json-api -->
        <dependency>
            <groupId>jakarta.json</groupId>
            <artifactId>jakarta.json-api</artifactId>
            <version>2.1.3</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.eclipse.parsson/parsson -->
        <dependency>
            <groupId>org.eclipse.parsson</groupId>
            <artifactId>parsson</artifactId>
            <version>1.1.5</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-xml -->
        <dependency>
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-xml</artifactId>
            <version>2.15.2</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.github.ben-manes.caffeine/caffeine -->
        <dependency>
            <groupId>com.github.ben-manes.caffeine</groupId>
            <artifactId>caffeine</artifactId>
            <version>3.1.8</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.14.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/commons-validator/commons-validator -->
        <dependency>
            <groupId>commons-validator</groupId>
            <artifactId>commons-validator</artifactId>
            <version>1.7</version>
        </dependency>

        <!-- Google Tink -->
        <!-- Note: that for EdDSA you need to include the optional Tink
        dependency in your project. For Nimbus JOSE+JWT 6.0 that would be -->
        <!--  https://mvnrepository.com/artifact/com.google.crypto.tink/tink -->
        <dependency>
            <groupId>com.google.crypto.tink</groupId>
            <artifactId>tink</artifactId>
            <version>1.11.0</version>
        </dependency>
        <!-- Net Crypto EDDSA -->
        <!-- Required for the EDSA Security Provider -->
        <!-- https://mvnrepository.com/artifact/net.i2p.crypto/eddsa -->
        <dependency>
            <groupId>net.i2p.crypto</groupId>
            <artifactId>eddsa</artifactId>
            <version>0.3.0</version>
        </dependency>

        <!-- JUnit -->
        <!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>5.10.1</version>
            <scope>test</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-engine -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>5.10.1</version>
            <scope>test</scope>
        </dependency>

        <!-- Mockito -->
        <!-- https://mvnrepository.com/artifact/org.mockito/mockito-core -->
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>5.7.0</version>
            <scope>test</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.mockito/mockito-junit-jupiter -->
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <version>5.7.0</version>
            <scope>test</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.testcontainers/testcontainers -->
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>testcontainers</artifactId>
            <version>1.19.3</version>
            <scope>test</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.testcontainers/junit-jupiter -->
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>1.19.3</version>
            <scope>test</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.testcontainers/nginx -->
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>nginx</artifactId>
            <version>1.19.3</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>${project.basedir}</directory>
                <includes>
                    <include>LICENSE</include>
                    <include>NOTICE.md</include>
                    <include>DEPENDENCIES</include>
                    <include>SECURITY.md</include>
                </includes>
                <targetPath>META-INF/</targetPath>
            </resource>
        </resources>
        <plugins>
            <!--
                The Maven Release Plugin can be used to automate the changes to the Maven POM files,
                sanity checks, the SCM operations required and the actual deployment execution.
            -->
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-release-plugin</artifactId>
              <version>3.0.1</version>
              <configuration>
                <tagNameFormat>@{project.version}</tagNameFormat>
                <autoVersionSubmodules>true</autoVersionSubmodules>
                <useReleaseProfile>false</useReleaseProfile>
                <releaseProfiles>ci-cd</releaseProfiles>
                <goals>deploy</goals>
              </configuration>
              <executions>
                <execution>
                  <id>default</id>
                  <goals>
                    <goal>perform</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>
            <plugin>
                <groupId>org.eclipse.dash</groupId>
                <artifactId>license-tool-plugin</artifactId>
                <version>1.0.2</version>
                <executions>
                    <execution>
                        <id>license-check</id>
                        <goals>
                            <goal>license-check</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <summary>DEPENDENCIES</summary>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok-maven-plugin</artifactId>
                <version>1.18.20.0</version>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>delombok</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <sourceDirectory>${originalSourceDirectory}</sourceDirectory>
                    <outputDirectory>${delombokSourceDirectory}</outputDirectory>
                    <addOutputDirectory>false</addOutputDirectory>
                    <encoding>UTF-8</encoding>
                    <formatPreferences>
                        <javaLangAsFQN>skip</javaLangAsFQN>
                    </formatPreferences>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>${com.diffplug.spotless.maven.plugin.version}</version>
                <configuration>
                    <java>
                        <googleJavaFormat>
                            <version>1.15.0</version>
                            <style>GOOGLE</style>
                        </googleJavaFormat>
                    </java>
                </configuration>
                <executions>
                    <execution>
                        <id>spotless-check</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>3.2.2</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-surefire-plugin</artifactId>
              <version>3.2.2</version>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>delombok</id>
            <properties>
                <sourceDir>${delombokSourceDirectory}</sourceDir>
            </properties>
        </profile>
        <profile>
            <id>ci-cd</id>
            <properties>
              <gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
            </properties>
            <!--
                Deployment of a Maven project
                docs: https://central.sonatype.org/publish/publish-maven/#review-requirements
            -->
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.13</version>
                        <extensions>true</extensions>
                        <configuration>
                            <!--
                                The id of the server as defined in 'settings.xml'
                                The username and password are retrieved from the server config in 'settings.xml'
                                docs: https://help.sonatype.com/repomanager2/staging-releases/configuring-your-project-for-deployment#ConfiguringYourProjectforDeployment-DeploymentwiththeNexusStagingMavenPlugin
                            -->
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org</nexusUrl>
                            <!--
                                setting to 'true' will cause './mvnw release:perform' to publish
                                to Maven Central automatically when OSSRH Staging is complete
                            -->
                            <autoReleaseAfterClose>${env.AUTO_RELEASE_AFTER_CLOSE}</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.1.0</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>
                    <!-- Required when publishing to Maven Central -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.3.0</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>3.6.2</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <repositories>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>central</id>
            <name>Maven Central</name>
            <url>https://repo1.maven.org/maven2</url>
        </pluginRepository>
        <!-- Eclipse Dash Tool to generate DEPENDENCIES file -->
        <pluginRepository>
            <id>dash-licenses-snapshots</id>
            <url>https://repo.eclipse.org/content/repositories/dash-licenses-releases/</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

    <distributionManagement>
        <!-- <repository></repository> is not needed as we're using nexus-staging-maven-plugin -->
        <snapshotRepository>
            <id>ossrh</id>
            <name>Maven Central Snapshots</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>

</project>
