<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you 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="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>

  <parent>
    <groupId>org.apache.syncope</groupId>
    <artifactId>syncope</artifactId>
    <version>4.1.1</version>
  </parent>

  <name>Apache Syncope SRA</name>
  <description>Apache Syncope SRA</description>
  <groupId>org.apache.syncope</groupId>
  <artifactId>syncope-sra</artifactId>
  <packaging>jar</packaging>
  
  <properties>
    <rootpom.basedir>${basedir}/..</rootpom.basedir>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-starter-gateway-server-webflux</artifactId>
    </dependency>

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

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-security</artifactId>
      <exclusions>
        <exclusion>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-logging</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-oauth2-client</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
    </dependency>

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

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-log4j2</artifactId>
    </dependency>
    <dependency>
      <groupId>com.lmax</groupId>
      <artifactId>disruptor</artifactId>
    </dependency>

    <dependency>
      <groupId>org.pac4j</groupId>
      <artifactId>pac4j-saml</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apereo.cas.client</groupId>
      <artifactId>cas-client-core</artifactId>
    </dependency>

    <dependency>
      <groupId>org.springframework.session</groupId>
      <artifactId>spring-session-core</artifactId> 
    </dependency>

    <dependency>
      <groupId>org.jsoup</groupId>
      <artifactId>jsoup</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.syncope.common.keymaster</groupId>
      <artifactId>syncope-common-keymaster-client-api</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.apache.syncope.client.am</groupId>
      <artifactId>syncope-client-am-lib</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.apache.syncope.common.keymaster</groupId>
      <artifactId>syncope-common-keymaster-client-zookeeper</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.curator</groupId>
      <artifactId>curator-test</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-transports-http-netty-server</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-contract-wiremock</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <inherited>true</inherited>
        <configuration>
          <systemPropertyVariables>
            <reactor.netty.http.server.accessLogEnabled>true</reactor.netty.http.server.accessLogEnabled>
            <syncope.log.dir>${project.build.directory}/log</syncope.log.dir>
          </systemPropertyVariables>
        </configuration>
      </plugin>

      <plugin>
        <groupId>io.github.git-commit-id</groupId>
        <artifactId>git-commit-id-maven-plugin</artifactId>
        <configuration>
          <failOnNoGitDirectory>false</failOnNoGitDirectory>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>build-info</id>
            <goals>
              <goal>build-info</goal>
            </goals>
          </execution>
          <execution>
            <id>repackage</id>
            <configuration>
              <layout>ZIP</layout>
              <classifier>exec</classifier>
              <attach>false</attach>
              <loaderImplementation>CLASSIC</loaderImplementation>
            </configuration>
            <goals>
              <goal>repackage</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

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

    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
      </resource>

      <resource>
        <directory>${basedir}/../src/main/resources</directory>
        <filtering>true</filtering>
        <includes>
          <include>banner.txt</include>
        </includes>
      </resource>

      <resource>
        <directory>${basedir}</directory>
        <targetPath>META-INF</targetPath>
        <includes>
          <include>LICENSE</include>
          <include>NOTICE</include>
        </includes>
      </resource>
    </resources>
    
    <testResources>
      <testResource>
        <directory>${basedir}/src/test/resources</directory>
        <filtering>true</filtering>
        <excludes>
          <exclude>**/*.p12</exclude>
          <exclude>**/*.jks</exclude>
        </excludes>
      </testResource>
      <testResource>
        <directory>${basedir}/src/test/resources</directory>
        <filtering>false</filtering>
        <includes>
          <include>**/*.p12</include>
          <include>**/*.jks</include>
        </includes>
      </testResource>
    </testResources>
  </build>

  <profiles>
    <profile>
      <id>debug</id>

      <properties>
        <maven.build.cache.skipCache>true</maven.build.cache.skipCache>
        <maven.test.skip>true</maven.test.skip>
      </properties>

      <dependencies>
        <dependency>
          <groupId>org.apache.syncope.common.keymaster.self</groupId>
          <artifactId>syncope-common-keymaster-client-self</artifactId>
          <version>${project.version}</version>
        </dependency>
      </dependencies>

      <build>
        <defaultGoal>clean package</defaultGoal>

        <plugins>
          <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
              <systemPropertyVariables>
                <reactor.netty.http.server.accessLogEnabled>true</reactor.netty.http.server.accessLogEnabled>
              </systemPropertyVariables>
              <jvmArguments>
                -Xdebug -Xrunjdwp:transport=dt_socket,address=8002,server=y,suspend=n
                -Djavax.net.ssl.trustStore=${basedir}/../fit/wa-reference/src/test/resources/keystore.jks -Djavax.net.ssl.trustStorePassword=password
              </jvmArguments>
              <profiles>
                <profile>debug</profile>
              </profiles>
            </configuration>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>run</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
        
        <resources>
          <resource>
            <directory>${basedir}/src/test/resources/debug</directory>
            <filtering>true</filtering>
            <excludes>
              <exclude>saml.keystore.jks</exclude>
            </excludes>
          </resource>
          <resource>
            <directory>${basedir}/src/test/resources/debug</directory>
            <filtering>false</filtering>
            <includes>
              <include>saml.keystore.jks</include>
            </includes>
          </resource>
        </resources>
      </build>
    </profile>

    <profile>
      <id>site</id>

      <build>
        <plugins>
          <plugin>
            <groupId>org.asciidoctor</groupId>
            <artifactId>asciidoctor-maven-plugin</artifactId>
            <inherited>false</inherited>
            <configuration>
              <skip>true</skip>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-site-plugin</artifactId>
            <inherited>true</inherited>
            <configuration>
              <skip>true</skip>
              <skipDeploy>true</skipDeploy>
              <generateReports>false</generateReports>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <id>copy-docs-to-site</id>
                <phase>none</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    
    <profile>
      <id>apache-release</id>

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <inherited>false</inherited>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
                <configuration>
                  <includes>
                    <include>${basedir}/LICENSE</include>
                    <include>${basedir}/NOTICE</include>
                  </includes>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
