<?xml version="1.0" encoding="UTF-8"?>
<!--
  The contents of this file are subject to the terms of the Common Development and
  Distribution License (the License). You may not use this file except in compliance with the
  License.

  You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
  specific language governing permission and limitations under the License.

  When distributing Covered Software, include this CDDL Header Notice in each file and include
  the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
  Header, with the fields enclosed by brackets [] replaced by your own identifying
  information: "Portions Copyright [year] [name of copyright owner]".

  Copyright 2010-2011 ApexIdentity Inc.
  Portions Copyright 2011-2016 ForgeRock AS.
  Portions copyright 2025-2026 3A Systems LLC.
-->
<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.openidentityplatform.openig</groupId>
    <artifactId>openig-project</artifactId>
    <version>6.1.1</version>
  </parent>
  <artifactId>openig-war</artifactId>
  <name>OpenIG web application</name>
  <packaging>war</packaging>

  <properties>
    <!-- If the binary-licensing profile is activated, we need the ForgeRock license there -->
    <forgerock.license.output.dir>${project.build.directory}/${project.build.finalName}/WEB-INF/legal-notices</forgerock.license.output.dir>
    <maven.cargo.containerId>tomcat10x</maven.cargo.containerId>
    <test.config.path>${basedir}/target/config</test.config.path>
  </properties>

  <dependencies>
    <dependency>
      <groupId>jakarta.servlet</groupId>
      <artifactId>jakarta.servlet-api</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
    </dependency>
    <dependency>
      <groupId>org.openidentityplatform.commons.http-framework</groupId>
      <artifactId>core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.openidentityplatform.commons.http-framework</groupId>
      <artifactId>servlet</artifactId>
    </dependency>
    <dependency>
      <groupId>org.openidentityplatform.openig</groupId>
      <artifactId>openig-saml</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.openidentityplatform.openig</groupId>
      <artifactId>openig-oauth2</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.openidentityplatform.openig</groupId>
      <artifactId>openig-uma</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.openidentityplatform.openig</groupId>
      <artifactId>openig-openam</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.openidentityplatform.openig</groupId>
      <artifactId>openig-ai</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.openidentityplatform.commons.audit</groupId>
      <artifactId>handler-csv</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.openidentityplatform.commons.audit</groupId>
      <artifactId>handler-syslog</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.openidentityplatform.commons.audit</groupId>
      <artifactId>handler-jdbc</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.openidentityplatform.commons.audit</groupId>
      <artifactId>handler-jms</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.openidentityplatform.commons.audit</groupId>
      <artifactId>handler-json</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.openidentityplatform.commons.audit</groupId>
      <artifactId>handler-elasticsearch</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.testng</groupId>
      <artifactId>testng</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.awaitility</groupId>
      <artifactId>awaitility</artifactId>
      <version>4.3.0</version>
      <scope>test</scope>
    </dependency>
      <dependency>
          <groupId>io.rest-assured</groupId>
          <artifactId>rest-assured</artifactId>
          <version>5.5.7</version>
          <scope>test</scope>
      </dependency>
      <dependency>
          <groupId>org.wiremock</groupId>
          <artifactId>wiremock</artifactId>
          <version>3.13.2</version>
          <scope>test</scope>
      </dependency>
    <dependency>
      <groupId>org.openidentityplatform.openig</groupId>
      <artifactId>openig-ui</artifactId>
      <version>${project.version}</version>
      <!-- Use provided in order to exclude that file from being placed in WEB-INF/lib -->
      <scope>provided</scope>
    </dependency>
  </dependencies>
  <build>
    <finalName>OpenIG-${project.version}</finalName>
    <plugins>
      <plugin>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>9.4.8.v20171121</version>
        <configuration>
          <scanIntervalSeconds>0</scanIntervalSeconds>
          <webAppConfig>
            <contextPath>/</contextPath>
          </webAppConfig>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-ui-resources</id>
            <goals>
              <goal>copy-dependencies</goal>
            </goals>
            <phase>generate-resources</phase>
            <configuration>
              <includeArtifactIds>openig-ui</includeArtifactIds>
              <stripVersion>true</stripVersion>
              <outputDirectory>${project.build.outputDirectory}</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <webResources>
            <resource>
              <targetPath>WEB-INF/legal-notices</targetPath>
              <directory>../</directory>
              <includes>
                <!-- The web-app does not include the documentation -->
                <include>CC-BY-NC-ND.txt</include>
                <include>LICENSE.md</include>
              </includes>
            </resource>
          </webResources>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <configuration>
          <skip>false</skip>
          <systemProperties>
            <test.config.path>${test.config.path}</test.config.path>
          </systemProperties>
          </configuration>
          <executions>
            <execution>
               <goals>
                 <goal>integration-test</goal>
               </goals>
               <phase>integration-test</phase>
               <id>integration-test</id>
            </execution>
          </executions>
        </plugin>
		<plugin>
			<groupId>org.codehaus.cargo</groupId>
			<artifactId>cargo-maven3-plugin</artifactId>
            <version>1.10.20</version>
			<extensions>true</extensions>
			<executions>
				<execution>
					<id>start</id>
					<phase>pre-integration-test</phase>
					<goals>
						<goal>start</goal>
					</goals>
					<configuration>
						<container>
							<timeout>180000</timeout>
						</container>
					</configuration>
				</execution>
				<execution>
					<id>stop</id>
					<phase>post-integration-test</phase>
					<goals>
						<goal>stop</goal>
					</goals>
					<configuration>
						<container>
							<timeout>60000</timeout>
						</container>
					</configuration>
				</execution>
			</executions>
			<configuration>
				<descriptor>src/assemble/merge.xml</descriptor>
				<archive>
					<addMavenDescriptor>false</addMavenDescriptor>
					<manifest>
						<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
						<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
					</manifest>
				</archive>
				<container>
                    <containerId>${maven.cargo.containerId}</containerId>
					<type>embedded</type>
					<!-- 	                    <zipUrlInstaller><url>https://repo.maven.apache.org/maven2/org/apache/tomcat/tomcat/8.5.50/tomcat-8.5.50.zip</url></zipUrlInstaller> -->
					<systemProperties>
						<file.encoding>UTF-8</file.encoding>
						<logback.configurationFile>${basedir}/src/test/resources/logback-test.xml</logback.configurationFile>
						<com.iplanet.services.debug.level>message</com.iplanet.services.debug.level>
						<com.iplanet.services.debug.directory />
						<com.sun.services.debug.mergeall>on</com.sun.services.debug.mergeall>
						<org.forgerock.openam.slf4j.enableTraceInMessage>true</org.forgerock.openam.slf4j.enableTraceInMessage>
                        <openig.base>${basedir}/target/config</openig.base>
					</systemProperties>
				</container>
				<deployables>
					<deployable>
						<type>war</type>
						<properties>
							<context>/</context>
						</properties>
						<pingURL>http://localhost:8080/openig/</pingURL>
					</deployable>
				</deployables>
				<configuration>
					<properties>
						<cargo.rmi.port>8206</cargo.rmi.port>
						<cargo.servlet.port>8080</cargo.servlet.port>
						<cargo.jvmargs>${java.surefire.options} -Xmx4g</cargo.jvmargs>
					</properties>
				</configuration>
			</configuration>
		</plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
        <id>jdk17.options</id>
        <activation>
            <jdk>[17,)</jdk>
        </activation>
        <properties>
            <maven.cargo.containerId>tomcat11x</maven.cargo.containerId>
        </properties>
    </profile>
  </profiles>
</project>
