<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (C) 2017-2025 Dominic Heutelbeck (dominic@heutelbeck.com)

    SPDX-License-Identifier: Apache-2.0

    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="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>io.sapl</groupId>
		<artifactId>sapl-policy-engine</artifactId>
		<version>3.0.0</version>
	</parent>
	<name>SAPL Language</name>
	<artifactId>sapl-lang</artifactId>
	<packaging>jar</packaging>
	<dependencies>
		<!-- SAPL APIs implemented or used by the SAPL language core -->
		<dependency>
			<groupId>io.sapl</groupId>
			<artifactId>sapl-pdp-api</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>io.sapl</groupId>
			<artifactId>sapl-extensions-api</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>io.sapl</groupId>
			<artifactId>sapl-generator</artifactId>
			<version>${project.version}</version>
			<optional>true</optional>
		</dependency>
		<!-- XText -->
		<dependency>
			<groupId>org.eclipse.xtext</groupId>
			<artifactId>org.eclipse.xtext</artifactId>
			<version>${xtext.version}</version>
		</dependency>
		<dependency>
			<groupId>org.eclipse.xtext</groupId>
			<artifactId>org.eclipse.xtext.xbase</artifactId>
			<version>${xtext.version}</version>
		</dependency>
		<dependency>
			<groupId>org.eclipse.xtext</groupId>
			<artifactId>org.eclipse.xtext.xtext.generator</artifactId>
			<version>${xtext.version}</version>
			<optional>true</optional>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.eclipse.emf</groupId>
			<artifactId>org.eclipse.emf.mwe2.launch</artifactId>
			<optional>true</optional>
		</dependency>
		<dependency>
			<groupId>org.eclipse.xtext</groupId>
			<artifactId>xtext-antlr-generator</artifactId>
			<optional>true</optional>
			<exclusions>
				<exclusion>
					<groupId>log4j</groupId>
					<artifactId>log4j</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>com.google.guava</groupId>
			<artifactId>guava</artifactId>
		</dependency>
		<!-- Logging -->
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-simple</artifactId>
			<scope>test</scope>
		</dependency>
		<!-- Utility -->
		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-lang3</artifactId>
		</dependency>
		<dependency>
			<groupId>commons-io</groupId>
			<artifactId>commons-io</artifactId>
			<!-- newer versions than 2.10.0 may break MQTT intrgration tests due to version
			conflicts with dependencies used during testing -->
			<version>2.18.0</version>
		</dependency>
		<dependency>
			<groupId>com.fasterxml.jackson.dataformat</groupId>
			<artifactId>jackson-dataformat-xml</artifactId>
		</dependency>
		<!-- JSON schema validation -->
		<dependency>
			<groupId>com.networknt</groupId>
			<artifactId>json-schema-validator</artifactId>
		</dependency>

		<!-- Webflux for the reactive WebClient -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webflux</artifactId>
		</dependency>
		<dependency>
			<groupId>io.projectreactor.netty</groupId>
			<artifactId>reactor-netty-http</artifactId>
		</dependency>

		<!-- Dependency for the Repeat and Back-Off -->
		<dependency>
			<groupId>io.projectreactor.addons</groupId>
			<artifactId>reactor-extra</artifactId>
		</dependency>
		<!-- Testing -->
		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter-params</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>io.sapl</groupId>
			<artifactId>sapl-hamcrest</artifactId>
			<version>${project.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>io.sapl</groupId>
			<artifactId>sapl-assertj</artifactId>
			<version>${project.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>com.squareup.okhttp3</groupId>
			<artifactId>okhttp</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>com.squareup.okhttp3</groupId>
			<artifactId>mockwebserver</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<groupId>ch.qos.logback</groupId>
					<artifactId>logback-classic</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-websocket</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-webflux</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>io.projectreactor</groupId>
			<artifactId>reactor-test</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.hamcrest</groupId>
			<artifactId>hamcrest</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.assertj</groupId>
			<artifactId>assertj-core</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>com.spotify</groupId>
			<artifactId>hamcrest-pojo</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>com.spotify</groupId>
			<artifactId>hamcrest-optional</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>com.spotify</groupId>
			<artifactId>hamcrest-jackson</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.eclipse.xtext</groupId>
			<artifactId>org.eclipse.xtext.testing</artifactId>
			<version>${xtext.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.eclipse.xtext</groupId>
			<artifactId>org.eclipse.xtext.xbase.testing</artifactId>
			<version>${xtext.version}</version>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<groupId>junit</groupId>
					<artifactId>junit</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.mockito</groupId>
			<artifactId>mockito-core</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.reflections</groupId>
			<artifactId>reflections</artifactId>
			<version>0.10.2</version>
			<scope>test</scope>
		</dependency>
	</dependencies>
	<build>
		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>exec-maven-plugin</artifactId>
				<version>3.1.0</version>
				<executions>
					<execution>
						<!--
							Attention: the ?m2e annotations may break validation of release packages
							being pushed to maven central.
						-->
						<?m2e ignore?>
						<id>mwe2GenerateEMFClasses</id>
						<phase>generate-sources</phase>
						<goals>
							<goal>java</goal>
						</goals>
						<configuration>
							<mainClass>
								org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher</mainClass>
							<arguments>
								<argument>
									/${project.basedir}/src/main/java/io/sapl/grammar/GenerateSAPLModel.mwe2
								</argument>
								<argument>-p</argument>
								<argument>rootPath=/${project.basedir}/..</argument>
							</arguments>
							<classpathScope>compile</classpathScope>
							<includePluginDependencies>true</includePluginDependencies>
							<cleanupDaemonThreads>false
							</cleanupDaemonThreads> <!-- see
							https://bugs.eclipse.org/bugs/show_bug.cgi?id=475098#c3 -->
							<systemProperties>
								<!-- Use custom logger configuration to make
								logs look like default
									maven logs. Attention: Setting this here spills over into the mwe2Launcher
									execution below. -->
								<systemProperty>
									<key>log4j.configuration</key>
									<value>
										file:${project.basedir}/plugin-log4j.properties</value>
								</systemProperty>
							</systemProperties>
						</configuration>
					</execution>
					<execution>
						<?m2e ignore?>
						<id>mwe2Launcher</id>
						<phase>generate-sources</phase>
						<goals>
							<goal>java</goal>
						</goals>
						<configuration>
							<mainClass>
								org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher</mainClass>
							<arguments>
								<argument>
									/${project.basedir}/src/main/java/io/sapl/grammar/GenerateSAPL.mwe2</argument>
								<argument>-p</argument>
								<argument>rootPath=/${project.basedir}/..</argument>
							</arguments>
							<classpathScope>compile</classpathScope>
							<includePluginDependencies>true</includePluginDependencies>
							<cleanupDaemonThreads>false
							</cleanupDaemonThreads> <!-- see
							https://bugs.eclipse.org/bugs/show_bug.cgi?id=475098#c3 -->
						</configuration>
					</execution>
				</executions>
				<dependencies>
					<dependency>
						<groupId>org.slf4j</groupId>
						<artifactId>slf4j-nop</artifactId>
						<version>2.0.11</version>
					</dependency>
				</dependencies>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-clean-plugin</artifactId>
				<configuration>
					<filesets combine.children="append">
						<fileset>
							<directory>
								${basedir}/../sapl-lang/src/main/xtext-gen/</directory>
							<includes>
								<include>**/*</include>
							</includes>
						</fileset>
						<fileset>
							<directory>${basedir}/../sapl-lang/src/main/emf-gen/</directory>
							<includes>
								<include>**/*</include>
							</includes>
						</fileset>
						<fileset>
							<directory>
								${basedir}/../sapl-lang/src/test/xtext-gen/</directory>
							<includes>
								<include>**/*</include>
							</includes>
						</fileset>
						<fileset>
							<directory>
								${basedir}/../sapl-ide/src/main/xtext-gen/</directory>
							<includes>
								<include>**/*</include>
							</includes>
						</fileset>
						<fileset>
							<directory>
								${basedir}/../sapl-web/src/main/xtext-gen/</directory>
							<includes>
								<include>**/*</include>
							</includes>
						</fileset>
						<fileset>
							<directory>${basedir}/model/generated/</directory>
						</fileset>
					</filesets>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>build-helper-maven-plugin</artifactId>
				<executions>
					<execution>
						<?m2e execute onConfiguration,onIncremental?>
						<id>add-source</id>
						<phase>initialize</phase>
						<goals>
							<goal>add-source</goal>
							<goal>add-resource</goal>
						</goals>
						<configuration>
							<sources>
								<source>src/main/xtext-gen</source>
								<source>src/main/emf-gen</source>
							</sources>
							<resources>
								<resource>
									<directory>src/main/xtext-gen</directory>
									<excludes>
										<exclude>**/*.java</exclude>
										<exclude>**/*.g</exclude>
									</excludes>
								</resource>
							</resources>
						</configuration>
					</execution>
					<execution>
						<?m2e execute onConfiguration,onIncremental?>
						<id>add-test-source</id>
						<phase>initialize</phase>
						<goals>
							<goal>add-test-source</goal>
							<goal>add-test-resource</goal>
						</goals>
						<configuration>
							<sources>
								<source>src/test/xtext-gen</source>
							</sources>
							<resources>
								<resource>
									<directory>src/test/xtext-gen</directory>
									<excludes>
										<exclude>**/*.java</exclude>
									</excludes>
								</resource>
							</resources>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>biz.aQute.bnd</groupId>
				<artifactId>bnd-maven-plugin</artifactId>
				<version>6.4.0</version>
				<executions>
					<execution>
						<goals>
							<goal>bnd-process</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<!-- Lombok is not needed as a runtime dependency but is
					automatically detected as one due when
                    SneakyThrows is in use because it leaves traces in the class files. This can be
					removed when the
                    project uses a version of lombok which contains a fix for
                     https://github.com/projectlombok/lombok/issues/3601 -->
					<bnd>
						Import-Package: com.google.common.*;version="32",\
						*
					</bnd>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<configuration>
					<archive>
						<manifestFile>
							${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
					</archive>
				</configuration>
			</plugin>
			<plugin>
				<groupId>net.ju-n.maven.plugins</groupId>
				<artifactId>checksum-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>
</project>
