<!--
  ~ Copyright 2023-2025 Sweden Connect
  ~
  ~ 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.
  -->
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <groupId>se.swedenconnect.spring.saml.idp</groupId>
  <artifactId>spring-saml-idp-parent</artifactId>
  <packaging>pom</packaging>
  <version>2.3.2</version>

  <name>Sweden Connect :: Spring SAML Identity Provider :: Parent POM</name>
  <description>Parent POM for Spring SAML Identity Provider libraries</description>
  <url>https://docs.swedenconnect.se/saml-identity-provider</url>

  <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:git:https://github.com/swedenconnect/saml-identity-provider.git</connection>
    <developerConnection>scm:git:https://github.com/swedenconnect/saml-identity-provider.git</developerConnection>
    <url>https://github.com/swedenconnect/saml-identity-provider/tree/master</url>
  </scm>

  <organization>
    <name>Sweden Connect</name>
    <url>https://www.swedenconnect.se</url>
  </organization>

  <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>
    <java.version>17</java.version>

    <spring.boot.version>3.4.1</spring.boot.version>
    <spring.version>6.2.1</spring.version>
    <bc.version>1.79</bc.version>
    <credentials-support.version>2.0.1</credentials-support.version>
    <lombok.version>1.18.36</lombok.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>

  <modules>
    <module>saml-identity-provider</module>
    <module>autoconfigure</module>
    <module>starter</module>
    <!--
    <module>samples</module>
    -->
  </modules>

  <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>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>${spring.boot.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>

      <dependency>
        <groupId>org.junit</groupId>
        <artifactId>junit-bom</artifactId>
        <type>pom</type>
        <version>5.11.4</version>
        <scope>import</scope>
      </dependency>

      <dependency>
        <groupId>se.swedenconnect.security</groupId>
        <artifactId>credentials-support</artifactId>
        <version>${credentials-support.version}</version>
      </dependency>

      <dependency>
        <groupId>se.swedenconnect.security</groupId>
        <artifactId>credentials-support-spring</artifactId>
        <version>${credentials-support.version}</version>
      </dependency>

      <dependency>
        <groupId>se.swedenconnect.security</groupId>
        <artifactId>credentials-support-opensaml</artifactId>
        <version>${credentials-support.version}</version>
      </dependency>

      <!-- Bouncy Castle -->
      <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>

      <!-- OpenSAML -->
      <dependency>
        <groupId>se.swedenconnect.opensaml</groupId>
        <artifactId>opensaml-security-ext</artifactId>
        <version>4.1.2</version>
      </dependency>

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

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

      <dependency>
        <groupId>se.swedenconnect.opensaml</groupId>
        <artifactId>opensaml-eidas</artifactId>
        <version>3.2.1</version>
      </dependency>

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

      <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>${lombok.version}</version>
        <scope>provided</scope>
      </dependency>

    </dependencies>

  </dependencyManagement>

  <dependencies>

    <dependency>
      <groupId>jakarta.servlet</groupId>
      <artifactId>jakarta.servlet-api</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>jakarta.annotation</groupId>
      <artifactId>jakarta.annotation-api</artifactId>
    </dependency>

    <!-- Logging -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>

    <!-- For testing -->
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <build>

    <pluginManagement>

      <plugins>

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

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

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

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

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>3.1.3</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-project-info-reports-plugin</artifactId>
          <version>3.7.0</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.10.1</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>3.3.1</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>3.20.0</version>
        </plugin>

        <plugin>
          <groupId>org.jacoco</groupId>
          <artifactId>jacoco-maven-plugin</artifactId>
          <version>0.8.12</version>
          <configuration>
            <excludes>
              <!-- Ignore coverage for exception classes -->
              <exclude>**/*Exception.class</exclude>
            </excludes>
          </configuration>
          <executions>
            <execution>
              <id>prepare-agent</id>
              <goals>
                <goal>prepare-agent</goal>
              </goals>
            </execution>
            <execution>
              <id>report</id>
              <goals>
                <goal>report</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

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

      </plugins>

    </pluginManagement>

    <plugins>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-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.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <configuration>
          <doclint>all,-missing</doclint>
          <links>
            <link>https://docs.spring.io/spring-framework/docs/current/javadoc-api/</link>
            <link>https://docs.swedenconnect.se/credentials-support/apidoc/</link>
            <!--<link>https://build.shibboleth.net/nexus/content/sites/site/java-opensaml/5.0.0/apidocs/</link>-->
            <!--<link>https://build.shibboleth.net/nexus/content/sites/site/java-shib-shared/9.0.0/apidocs/</link>-->
            <link>https://docs.swedenconnect.se/opensaml-security-ext/javadoc/</link>
            <link>https://docs.swedenconnect.se/opensaml-addons/apidoc/</link>
            <link>https://docs.swedenconnect.se/opensaml-eidas/apidocs/</link>
          </links>
          <detectJavaApiLink>true</detectJavaApiLink>
        </configuration>
      </plugin>

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

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

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-deploy-plugin</artifactId>
        <configuration>
          <skip>true</skip>
        </configuration>
      </plugin>

      <!-- run mvn jacoco:report -->
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

    </plugins>

  </build>

  <profiles>

    <profile>
      <id>release</id>

      <!-- See http://central.sonatype.org/pages/apache-maven.html for setup -->

      <build>
        <plugins>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
              <execution>
                <phase>process-sources</phase>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
              <execution>
                <phase>process-test-sources</phase>
                <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>
              <execution>
                <id>aggregate</id>
                <goals>
                  <goal>aggregate</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <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>
              <!--
                Allows manual inspection of the staging repo before deploying it to the central repo.
                Use 'mvn nexus-staging:release -Prelease' to release and 'mvn nexus-staging:drop' to abort.
              -->
            </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>

        </plugins>
      </build>

    </profile>

  </profiles>

</project>
