<?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>se.swedenconnect.eid</groupId>
  <artifactId>test-my-eid</artifactId>
  <version>3.1.0</version>
  <packaging>jar</packaging>

  <name>test-my-eid</name>
  <description>Sweden Connect - Test my eID</description>
  <url>https://github.com/swedenconnect/test-my-eid</url>

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

  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <scm>
    <connection>scm:https://github.com/swedenconnect/test-my-eid.git</connection>
    <developerConnection>scm:https://github.com/swedenconnect/test-my-eid.git</developerConnection>
    <url>https://github.com/swedenconnect/test-my-eid/tree/master</url>
  </scm>

  <developers>
    <developer>
      <name>Martin Lindström</name>
      <email>martin@idsec.se</email>
      <organization>IDsec Solutions AB</organization>
      <organizationUrl>https://www.idsec.se</organizationUrl>
    </developer>
  </developers>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>21</java.version>
    <opensaml.version>5.1.2</opensaml.version>
    <spring.version>6.1.13</spring.version>
    <bc.version>1.78.1</bc.version>
  </properties>

  <repositories>

    <repository>
      <id>central</id>
      <name>Maven Central</name>
      <url>https://repo1.maven.org/maven2/</url>
    </repository>
    <repository>
      <id>shibboleth</id>
      <name>Shibboleth Maven Repo</name>
      <url>https://build.shibboleth.net/nexus/content/repositories/releases</url>
    </repository>
  </repositories>

  <distributionManagement>
    <snapshotRepository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
    <repository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
  </distributionManagement>

  <dependencyManagement>

    <dependencies>

      <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-framework-bom</artifactId>
        <type>pom</type>
        <version>${spring.version}</version>
        <scope>import</scope>
      </dependency>

      <dependency>
        <groupId>se.swedenconnect.security</groupId>
        <artifactId>credentials-support</artifactId>
        <version>1.3.2</version>
      </dependency>

      <dependency>
        <groupId>se.swedenconnect.opensaml</groupId>
        <artifactId>opensaml-security-ext</artifactId>
        <version>4.1.1</version>
      </dependency>

      <dependency>
        <groupId>se.swedenconnect.opensaml</groupId>
        <artifactId>opensaml-addons</artifactId>
        <version>2.1.1</version>
      </dependency>

      <dependency>
        <groupId>se.swedenconnect.opensaml</groupId>
        <artifactId>opensaml-swedish-eid</artifactId>
        <version>2.2.1</version>
      </dependency>

      <dependency>
        <groupId>org.bouncycastle</groupId>
        <artifactId>bcprov-jdk18on</artifactId>
        <version>${bc.version}</version>
      </dependency>

      <dependency>
        <groupId>org.bouncycastle</groupId>
        <artifactId>bcutil-jdk18on</artifactId>
        <version>${bc.version}</version>
      </dependency>

      <dependency>
        <groupId>org.bouncycastle</groupId>
        <artifactId>bcpkix-jdk18on</artifactId>
        <version>${bc.version}</version>
      </dependency>

      <dependency>
        <groupId>org.apache.santuario</groupId>
        <artifactId>xmlsec</artifactId>
        <version>3.0.4</version>
      </dependency>

    </dependencies>
  </dependencyManagement>


  <dependencies>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-configuration-processor</artifactId>
      <optional>true</optional>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-devtools</artifactId>
      <scope>runtime</scope>
    </dependency>

    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
    </dependency>

    <dependency>
      <groupId>se.swedenconnect.security</groupId>
      <artifactId>credentials-support</artifactId>
    </dependency>

    <dependency>
      <groupId>se.swedenconnect.opensaml</groupId>
      <artifactId>opensaml-security-ext</artifactId>
    </dependency>

    <dependency>
      <groupId>se.swedenconnect.opensaml</groupId>
      <artifactId>opensaml-addons</artifactId>
    </dependency>

    <dependency>
      <groupId>se.swedenconnect.opensaml</groupId>
      <artifactId>opensaml-swedish-eid</artifactId>
    </dependency>

    <dependency>
      <groupId>org.webjars</groupId>
      <artifactId>bootstrap</artifactId>
      <version>4.6.2</version>
      <exclusions>
        <exclusion>
          <groupId>org.webjars</groupId>
          <artifactId>jquery</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.webjars</groupId>
          <artifactId>popper.js</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.webjars</groupId>
      <artifactId>popper.js</artifactId>
      <version>1.16.1-lts</version>
    </dependency>

    <dependency>
      <groupId>org.webjars</groupId>
      <artifactId>jquery</artifactId>
      <version>3.7.1</version>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <build>

    <plugins>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <release>${java.version}</release>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-clean-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>repackage</id>
            <configuration>
              <classifier>exec</classifier>
            </configuration>
          </execution>
          <execution>
            <goals>
              <goal>build-info</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <execution>
            <id>enforce</id>
            <configuration>
              <rules>
                <dependencyConvergence/>
              </rules>
            </configuration>
            <goals>
              <goal>enforce</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>com.google.cloud.tools</groupId>
        <artifactId>jib-maven-plugin</artifactId>
        <version>3.4.3</version>
        <configuration>
          <from>
            <image>openjdk:21-jdk-slim</image>
            <platforms>
              <platform>
                <architecture>amd64</architecture>
                <os>linux</os>
              </platform>
              <platform>
                <architecture>arm64</architecture>
                <os>linux</os>
              </platform>
            </platforms>
          </from>
          <to>
            <image>${DOCKER_REPO}/swedenconnect/test-my-eid</image>
            <tags>
              <tag>${project.version}</tag>
            </tags>
          </to>
          <container>
            <mainClass>se.swedenconnect.eid.sp.TestMyEidApplication</mainClass>
            <creationTime>USE_CURRENT_TIMESTAMP</creationTime>
            <jvmFlags>
              <jvmFlag>-Djava.net.preferIPv4Stack=true</jvmFlag>
              <jvmFlag>-Dorg.apache.xml.security.ignoreLineBreaks=true</jvmFlag>
            </jvmFlags>
            <ports>
              <port>8443</port>
              <port>8444</port>
            </ports>
            <labels>
              <org.opencontainers.image.source>
                https://github.com/swedenconnect/test-my-eid
              </org.opencontainers.image.source>
              <org.opencontainers.image.description>
                Sweden Connect Test my eID
              </org.opencontainers.image.description>
              <org.opencontainers.image.licenses>Apache-2.0</org.opencontainers.image.licenses>
            </labels>
          </container>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>3.10.0</version>
        <configuration>
          <doclint>all</doclint>
          <detectJavaApiLink>true</detectJavaApiLink>
          <doctitle>Test my eID - ${project.version}</doctitle>
          <windowtitle>Test my eID - ${project.version}</windowtitle>
          <links>
            <link>https://docs.spring.io/spring-framework/docs/current/javadoc-api/</link>
            <link>https://docs.spring.io/spring-boot/api/java/</link>
            <link>https://docs.swedenconnect.se/credentials-support/apidoc/</link>
            <link>https://docs.swedenconnect.se/opensaml-addons/apidoc/</link>
            <link>https://docs.swedenconnect.se/opensaml-swedish-eid/apidoc/</link>
          </links>
        </configuration>
      </plugin>

    </plugins>
  </build>

  <profiles>
    <profile>
      <id>release</id>

      <build>
        <plugins>

          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>1.7.0</version>
            <extensions>true</extensions>
            <configuration>
              <serverId>ossrh</serverId>
              <nexusUrl>https://oss.sonatype.org/</nexusUrl>
              <autoReleaseAfterClose>true</autoReleaseAfterClose>
            </configuration>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>3.2.6</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <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>
              <execution>
                <id>attach-test-sources</id>
                <goals>
                  <goal>test-jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

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

        </plugins>
      </build>

    </profile>
  </profiles>

</project>
