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

    Copyright © 2017-2021 Dominic Heutelbeck (dominic@heutelbeck.com)

    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.

-->
<!-- 
	Utility goals supported by the POM:
	
	* Update the version of all modules:
	  mvn versions:set -DnewVersion=2.0.0-RC1 -DprocessAllModules -DgenerateBackupPoms=false
	  
	* Correct the license headers of all source files:
	  mvn license:format
	  
	* Format the code according to Spring code formatting conventions:
	  mvn spring-javaformat:apply 
-->
<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>io.sapl</groupId>
	<artifactId>sapl-policy-engine</artifactId>
	<version>2.0.0</version>

	<packaging>pom</packaging>

	<name>Streaming Attribute Authorization Engine</name>

	<description>Auhtorization Engine for Attribute Stream-Based Access Control (ASBAC)</description>

	<url>https://sapl.io</url>

	<developers>
		<developer>
			<name>Dominic Heutelbeck</name>
			<email>dominic@heutelbeck.com</email>
			<roles>
				<role>Project Owner</role>
			</roles>
			<url>https://github.com/heutelbeck</url>
			<id>heutelbeck</id>
		</developer>
	</developers>

	<inceptionYear>2017-2021</inceptionYear>

	<licenses>
		<license>
			<name>Apache 2.0</name>
			<url>https://www.apache.org/licenses/LICENSE-2.0</url>
		</license>
	</licenses>

	<scm>
		<connection>scm:git:git://github.com/heutelbeck/sapl-policy-engine.git</connection>
		<developerConnection>scm:git:git@github.com:heutelbeck/sapl-policy-engine.git</developerConnection>
		<url>https://github.com/heutelbeck/sapl-policy-engine</url>
	</scm>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

		<java.version>11</java.version>
		<maven.compiler.source>${java.version}</maven.compiler.source>
		<maven.compiler.target>${java.version}</maven.compiler.target>

		<xtext.version>2.25.0</xtext.version>
		<junit.version>5.7.2</junit.version>
		<junit4.version>4.13.2</junit4.version>
		<lombok.version>1.18.22</lombok.version>
		<hamcrest.version>2.2</hamcrest.version>
		<spotify.hamcrest.version>1.2.0</spotify.hamcrest.version>
		<springboot.version>2.5.7</springboot.version>
		<mockito.version>3.12.4</mockito.version>
		<vaadin.version>14.7.3</vaadin.version>
		<guice.version>5.0.1</guice.version>

		<license-maven-plugin.version>4.1</license-maven-plugin.version>
		<maven-javadoc-plugin.version>3.2.0</maven-javadoc-plugin.version>

		<dockerfile-maven-plugin.version>1.4.13</dockerfile-maven-plugin.version>
		<docker-registry-url>ghcr.io/heutelbeck</docker-registry-url>
	</properties>

	<modules>
		<module>sapl-pdp-api</module>
		<module>sapl-extensions-api</module>
		<module>sapl-hamcrest</module>
		<module>sapl-generator</module>
		<module>sapl-lang</module>
		<module>sapl-ide</module>
		<module>sapl-web</module>
		<module>sapl-test</module>
		<module>sapl-coverage-api</module>
		<module>sapl-maven-plugin</module>
		<module>sapl-jwt</module>
		<module>sapl-pdp-embedded</module>
		<module>sapl-pdp-remote</module>
		<module>sapl-spring-pdp-embedded</module>
		<module>sapl-spring-pdp-remote</module>
		<module>sapl-spring-security</module>
		<module>sapl-webflux-endpoint</module>
		<module>sapl-documentation</module>
		<module>sapl-server-lt</module>
		<module>sapl-bom</module>
	</modules>

	<dependencyManagement>
		<dependencies>

			<!-- XText -->
			<dependency>
				<groupId>org.eclipse.xtext</groupId>
				<artifactId>xtext-dev-bom</artifactId>
				<version>${xtext.version}</version>
				<type>pom</type>
				<scope>import</scope>
				<exclusions>
					<exclusion>
						<groupId>org.hamcrest</groupId>
						<artifactId>hamcrest-library</artifactId>
					</exclusion>
					<exclusion>
						<groupId>org.hamcrest</groupId>
						<artifactId>hamcrest-core</artifactId>
					</exclusion>
				</exclusions>
			</dependency>

			<!-- Testing Scope Dependencies -->
			<dependency>
				<groupId>org.junit</groupId>
				<artifactId>junit-bom</artifactId>
				<version>${junit.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
			<dependency>
		<!-- explicitly override transient junit 4 dependencies to fix CVE-2020-15250 -->
				<groupId>junit</groupId>
				<artifactId>junit</artifactId>
				<version>${junit4.version}</version>
				<scope>test</scope>
			</dependency>
			<dependency>
				<groupId>org.mockito</groupId>
				<artifactId>mockito-core</artifactId>
				<version>${mockito.version}</version>
			</dependency>
			<dependency>
				<groupId>org.mockito</groupId>
				<artifactId>mockito-inline</artifactId>
				<version>${mockito.version}</version>
			</dependency>
			<dependency>
				<groupId>org.hamcrest</groupId>
				<artifactId>hamcrest</artifactId>
				<version>${hamcrest.version}</version>
			</dependency>
			<dependency>
				<groupId>com.spotify</groupId>
				<artifactId>hamcrest-pojo</artifactId>
				<version>${spotify.hamcrest.version}</version>
			</dependency>
			<dependency>
				<groupId>com.spotify</groupId>
				<artifactId>hamcrest-optional</artifactId>
				<version>${spotify.hamcrest.version}</version>
			</dependency>
			<dependency>
				<groupId>com.spotify</groupId>
				<artifactId>hamcrest-jackson</artifactId>
				<version>${spotify.hamcrest.version}</version>
			</dependency>
			<dependency>
				<groupId>nl.jqno.equalsverifier</groupId>
				<artifactId>equalsverifier</artifactId>
				<version>3.5.5</version>
			</dependency>
			<!-- Spring-Boot -->
			<dependency>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-dependencies</artifactId>
				<version>${springboot.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>

			<!-- Project Reactor -->
			<dependency>
				<groupId>io.projectreactor</groupId>
				<artifactId>reactor-bom</artifactId>
				<version>Californium-RELEASE</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>

			<!-- Project Lombok -->
			<dependency>
				<groupId>org.projectlombok</groupId>
				<artifactId>lombok</artifactId>
				<version>${lombok.version}</version>
			</dependency>

			<!-- Vaadin -->
			<dependency>
				<groupId>com.vaadin</groupId>
				<artifactId>vaadin-bom</artifactId>
				<version>${vaadin.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>

			<dependency>
				<groupId>com.google.inject</groupId>
				<artifactId>guice</artifactId>
				<version>${guice.version}</version>
			</dependency>
		</dependencies>
	</dependencyManagement>

	<build>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-compiler-plugin</artifactId>
					<version>3.8.1</version>
					<configuration>
						<source>${java.version}</source>
						<target>${java.version}</target>
						<annotationProcessorPaths>
							<path>
								<groupId>org.projectlombok</groupId>
								<artifactId>lombok</artifactId>
								<version>${lombok.version}</version>
							</path>
						</annotationProcessorPaths>
						<compilerArgs>
							<arg>-parameters</arg>
						</compilerArgs>
					</configuration>
				</plugin>
				<plugin>
					<groupId>org.springframework.boot</groupId>
					<artifactId>spring-boot-maven-plugin</artifactId>
					<version>${springboot.version}</version>
				</plugin>
				<plugin>
					<groupId>com.vaadin</groupId>
					<artifactId>vaadin-maven-plugin</artifactId>
					<version>${vaadin.version}</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-jar-plugin</artifactId>
					<version>3.2.0</version>
				</plugin>
				<plugin>
					<groupId>org.eclipse.xtend</groupId>
					<artifactId>xtend-maven-plugin</artifactId>
					<version>${xtext.version}</version>
					<executions>
						<execution>
							<goals>
								<goal>compile</goal>
								<goal>xtend-install-debug-info</goal>
								<goal>testCompile</goal>
								<goal>xtend-test-install-debug-info</goal>
							</goals>
						</execution>
					</executions>
					<configuration>
						<showEmptyDirWarning>false</showEmptyDirWarning>
						<outputDirectory>${basedir}/src/main/xtend-gen</outputDirectory>
						<testOutputDirectory>${basedir}/src/test/xtend-gen</testOutputDirectory>
					</configuration>
					<dependencies>
						<!-- Prevent illegal access with newer JDKs -->
						<dependency>
							<groupId>com.google.inject</groupId>
							<artifactId>guice</artifactId>
							<version>${guice.version}</version>
						</dependency>
					</dependencies>
				</plugin>
				<plugin>
					<groupId>io.spring.javaformat</groupId>
					<artifactId>spring-javaformat-maven-plugin</artifactId>
					<version>0.0.29</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-clean-plugin</artifactId>
					<version>3.1.0</version>
					<configuration>
						<filesets>
							<fileset>
								<directory>${basedir}/src/main/xtend-gen</directory>
								<includes>
									<include>**/*</include>
								</includes>
							</fileset>
							<fileset>
								<directory>${basedir}/src/test/xtend-gen</directory>
								<includes>
									<include>**/*</include>
								</includes>
							</fileset>
						</filesets>
					</configuration>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-source-plugin</artifactId>
					<executions>
						<execution>
							<id>attach-sources</id>
							<goals>
								<goal>jar</goal>
							</goals>
						</execution>
					</executions>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-surefire-plugin</artifactId>
					<version>2.22.2</version>
					<configuration>
						<!-- workaround for https://issues.apache.org/jira/browse/SUREFIRE-1588 -->
						<useSystemClassLoader>false</useSystemClassLoader>
					</configuration>
				</plugin>
				<plugin>
					<groupId>com.mycila</groupId>
					<artifactId>license-maven-plugin</artifactId>
					<version>${license-maven-plugin.version}</version>
				</plugin>
				<plugin>
					<groupId>com.spotify</groupId>
					<artifactId>dockerfile-maven-plugin</artifactId>
					<version>${dockerfile-maven-plugin.version}</version>
				</plugin>
			</plugins>
		</pluginManagement>
		<plugins>
			<plugin>
				<groupId>com.mycila</groupId>
				<artifactId>license-maven-plugin</artifactId>
				<configuration>
					<header>APACHE-2.txt</header>
					<properties>
						<owner>Dominic Heutelbeck</owner>
						<email>dominic@heutelbeck.com</email>
					</properties>
					<excludes>
						<exclude>**/README</exclude>
						<exclude>node_modules/**</exclude>
						<exclude>src/test/resources/**</exclude>
						<exclude>src/test/xtend-gen/**</exclude>
						<exclude>src/test/xtext-gen/**</exclude>
						<exclude>src/main/xtend-gen/**</exclude>
						<exclude>src/main/xtext-gen/**</exclude>
						<exclude>src/main/emf-gen/**</exclude>
						<exclude>src/main/resources/**</exclude>
						<exclude>.gitattributes</exclude>
						<exclude>src/main/java/io/sapl/grammar/web/SAPLWebSetup.xtend</exclude>
						<exclude>src/main/java/io/sapl/grammar/web/SAPLWebModule.xtend</exclude>
						<exclude>src/asciidoc/sapl-grammar.ebnf</exclude>
					</excludes>
					<mapping>
						<md>XML_STYLE</md>
						<java>SLASHSTAR_STYLE</java>
						<adoc>DOUBLESLASH_STYLE</adoc>
						<ad>DOUBLESLASH_STYLE</ad>
						<xtend>SLASHSTAR_STYLE</xtend>
						<mwe2>SLASHSTAR_STYLE</mwe2>
						<ecore>XML_STYLE</ecore>
						<genmodel>XML_STYLE</genmodel>
						<xtext>SLASHSTAR_STYLE</xtext>
						<config>SCRIPT_STYLE</config>
					</mapping>
				</configuration>
				<!-- To check every build: <executions><execution><goals><goal>check</goal></goals></execution></executions> -->
			</plugin>
			<plugin>
				<groupId>org.commonjava.maven.plugins</groupId>
				<artifactId>directory-maven-plugin</artifactId>
				<version>0.3.1</version>
				<executions>
					<execution>
						<id>directories</id>
						<goals>
							<goal>directory-of</goal>
						</goals>
						<phase>check</phase>
						<configuration>
							<property>sapl.basedir</property>
							<project>
								<groupId>io.sapl</groupId>
								<artifactId>sapl-policy-engine</artifactId>
							</project>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>io.spring.javaformat</groupId>
				<artifactId>spring-javaformat-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>

	<profiles>
		<profile>
			<id>publish</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-deploy-plugin</artifactId>
						<configuration>
							<skip>true</skip>
						</configuration>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-source-plugin</artifactId>
						<version>3.2.1</version>
						<executions>
							<execution>
								<id>attach-sources</id>
								<goals>
									<goal>jar</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-javadoc-plugin</artifactId>
						<version>3.3.1</version>
						<executions>
							<execution>
								<id>attach-javadocs</id>
								<goals>
									<goal>jar</goal>
								</goals>
							</execution>
						</executions>
						<configuration>
							<doclint>none</doclint>
							<tags>
								<tag>
									<name>generated</name>
									<placement>a</placement>
									<head>Generated Code</head>
								</tag>
								<tag>
									<name>ordered</name>
									<placement>a</placement>
									<head>EMF Ordered</head>
								</tag>
								<tag>
									<name>model</name>
									<placement>a</placement>
									<head>EMF Model</head>
								</tag>
								<tag>
									<name>returns</name>
									<placement>a</placement>
									<head>EMF Returns:</head>
								</tag>
							</tags>
						</configuration>
					</plugin>
					<plugin>
						<groupId>org.sonatype.plugins</groupId>
						<artifactId>nexus-staging-maven-plugin</artifactId>
						<version>1.6.8</version>
						<extensions>true</extensions>
						<executions>
							<execution>
								<id>default-deploy</id>
								<phase>deploy</phase>
								<goals>
									<goal>deploy</goal>
								</goals>
							</execution>
						</executions>
						<configuration>
							<serverId>ossrh</serverId>
							<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
							<autoReleaseAfterClose>true</autoReleaseAfterClose>
						</configuration>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-gpg-plugin</artifactId>
						<version>1.6</version>
						<configuration>
							<!-- prevent gpg from using PIN entry programs -->
							<gpgArguments>
								<arg>--pinentry-mode</arg>
								<arg>loopback</arg>
							</gpgArguments>
						</configuration>
						<executions>
							<execution>
								<id>sign-artifacts</id>
								<phase>verify</phase>
								<goals>
									<goal>sign</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>

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

</project>
