<?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>

	<!-- this must come before <parent> because the version is manually updated
		in build-artifacts.sh -->
	<groupId>org.apache.isis.app</groupId>
	<artifactId>isis-app-starter-parent</artifactId>
	<version>2.0.0-M7</version>
	<packaging>pom</packaging>

	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.6.4</version>
		<relativePath />
	</parent>

	<name>Apache Isis Starter Parent</name>
	<description>
		Parent pom providing dependency and plugin management for Apache Isis applications
		built with Maven. Builds on top of spring-boot-starter-parent.
	</description>
	<url>https://isis.apache.org</url>

	<properties>

		<maven.compiler.release>11</maven.compiler.release>

		<spring-boot.version>2.6.4</spring-boot.version>
		<approvaltests.version>13.4.0</approvaltests.version>
		
		<resteasy.version>4.6.2.Final</resteasy.version> <!-- keep in sync with property defined in resteasy4-spring-boot-starter -->

	</properties>

	<build>
		<pluginManagement>
			<plugins>
				<!-- Compile -->
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-compiler-plugin</artifactId>
					<version>${maven-compiler-plugin.version}</version>
					<configuration>
						<showDeprecation>false</showDeprecation>
						<showWarnings>false</showWarnings>
						<!-- Java compliance level, to be overridden with option maven.compiler.release -->
					</configuration>
					<!-- goal:compile binds to phase:compile -->
					<!-- goal:testCompile binds to phase:test-compile -->
				</plugin>

				<!-- SITE REPORT -->
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-site-plugin</artifactId>
					<version>3.11.0</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-project-info-reports-plugin</artifactId>
					<version>3.1.2</version>
				</plugin>

			</plugins>
		</pluginManagement>
	</build>
	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.apache.isis.core</groupId>
				<artifactId>isis-core</artifactId>
				<version>2.0.0-M7</version>
				<scope>import</scope>
				<type>pom</type>
			</dependency>

			<dependency>
				<groupId>org.apache.isis.extensions</groupId>
				<artifactId>isis-extensions</artifactId>
				<version>2.0.0-M7</version>
				<scope>import</scope>
				<type>pom</type>
			</dependency>

			<dependency>
				<groupId>org.apache.isis.mappings</groupId>
				<artifactId>isis-mappings</artifactId>
				<version>2.0.0-M7</version>
				<scope>import</scope>
				<type>pom</type>
			</dependency>

			<dependency>
				<groupId>org.apache.isis.subdomains</groupId>
				<artifactId>isis-subdomains</artifactId>
				<version>2.0.0-M7</version>
				<scope>import</scope>
				<type>pom</type>
			</dependency>

			<dependency>
				<groupId>org.apache.isis.testing</groupId>
				<artifactId>isis-testing</artifactId>
				<version>2.0.0-M7</version>
				<scope>import</scope>
				<type>pom</type>
			</dependency>

			<dependency>
				<groupId>org.apache.isis.mavendeps</groupId>
				<artifactId>isis-mavendeps-integtests</artifactId>
				<version>2.0.0-M7</version>
				<type>pom</type>
			</dependency>

			<dependency>
				<groupId>org.apache.isis.valuetypes</groupId>
				<artifactId>isis-valuetypes</artifactId>
				<version>2.0.0-M7</version>
				<scope>import</scope>
				<type>pom</type>
			</dependency>

			<dependency>
				<groupId>com.approvaltests</groupId>
				<artifactId>approvaltests</artifactId>
				<version>${approvaltests.version}</version>
				<scope>test</scope>
			</dependency>

		</dependencies>
	</dependencyManagement>

	<profiles>
		<profile>
			<id>isis-app-starter-datanucleusenhance</id>
			<activation>
				<file>
					<exists>${basedir}/logging-dn-enhance.properties</exists>
				</file>
			</activation>
			<properties>

				<!-- keep in sync with versions used in Apache Isis -->
				<datanucleus-api-jdo.version>6.0.0-m3</datanucleus-api-jdo.version>
				<datanucleus-core.version>6.0.0-m3</datanucleus-core.version>
				<datanucleus-jodatime.version>6.0.0-m3</datanucleus-jodatime.version>
				<datanucleus-maven-plugin.version>6.0.0-m1</datanucleus-maven-plugin.version>
		
				<datanucleus-maven-plugin.log4jConfiguration>${basedir}/logging-dn-enhance.properties</datanucleus-maven-plugin.log4jConfiguration>
				<datanucleus-maven-plugin.verbose>true</datanucleus-maven-plugin.verbose>
				<datanucleus-maven-plugin.fork>false</datanucleus-maven-plugin.fork>

			</properties>
			<build>
				<plugins>
					<plugin>
						<groupId>org.datanucleus</groupId>
						<artifactId>datanucleus-maven-plugin</artifactId>
						<version>${datanucleus-maven-plugin.version}</version>
						<configuration>
							<fork>${datanucleus-maven-plugin.fork}</fork>
							<log4jConfiguration>${datanucleus-maven-plugin.log4jConfiguration}</log4jConfiguration>
							<verbose>${datanucleus-maven-plugin.verbose}</verbose>
						</configuration>
						<executions>
							<execution>
								<id>process-classes</id>
								<phase>process-classes</phase>
								<goals>
									<goal>enhance</goal>
								</goals>
							</execution>
							<execution>
								<id>process-test-classes</id>
								<phase>process-test-classes</phase>
								<goals>
									<goal>test-enhance</goal>
								</goals>
								<configuration>
									<metadataDirectory>${project.build.testOutputDirectory}</metadataDirectory>
								</configuration>
							</execution>
						</executions>
						<dependencies>
							<dependency>
								<groupId>org.datanucleus</groupId>
								<artifactId>datanucleus-core</artifactId>
								<version>${datanucleus-core.version}</version>
							</dependency>
							<dependency>
								<groupId>org.datanucleus</groupId>
								<artifactId>datanucleus-api-jdo</artifactId>
								<version>${datanucleus-api-jdo.version}</version>
							</dependency>
							<dependency>
								<groupId>org.datanucleus</groupId>
								<artifactId>datanucleus-jodatime</artifactId>
								<version>${datanucleus-jodatime.version}</version>
							</dependency>
						</dependencies>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>isis-app-starter-surefire</id>
			<activation>
				<property>
					<name>!skip.isis-app-starter-surefire</name>
				</property>
			</activation>

			<properties>
				<!-- uses maven-surefire-plugin.version, which is declared by spring-boot-starter-parent -->
				<skipTests>false</skipTests>
				<skipUTs>${skipTests}</skipUTs>
				<skipITs>${skipTests}</skipITs>
                <skipBDDs>${skipTests}</skipBDDs>
				<surefire-plugin.argLine></surefire-plugin.argLine>
			</properties>

			<build>
				<pluginManagement>
					<plugins>
						<plugin>
							<groupId>org.apache.maven.plugins</groupId>
							<artifactId>maven-surefire-plugin</artifactId>
							<version>${maven-surefire-plugin.version}</version>
							<executions>
								<execution>
									<id>default-test</id>
									<phase>test</phase>
									<goals>
										<goal>test</goal>
									</goals>
									<configuration>
										<skipTests>${skipUTs}</skipTests>
										<includes>
											<include>**/*Test*.java</include>
										</includes>
										<excludes>
											<exclude>**/*Testing.java</exclude>
											<exclude>**/*IntegTest*.java</exclude>
											<exclude>**/*Abstract*.java</exclude>
										</excludes>
										<useFile>true</useFile>
										<printSummary>true</printSummary>
										<reportsDirectory>${project.build.directory}/surefire-unittest-reports</reportsDirectory>
										<forkCount>1</forkCount>
										<reuseForks>true</reuseForks>
										<argLine>${surefire-plugin.argLine}</argLine>
									</configuration>
								</execution>
								<execution>
									<id>integ-test</id>
									<phase>integration-test</phase>
									<goals>
										<goal>test</goal>
									</goals>
									<configuration>
										<skipTests>${skipITs}</skipTests>
										<includes>
											<include>**/*IntegTest*.java</include>
										</includes>
										<excludes>
											<exclude>**/*Abstract*.java</exclude>
										</excludes>
										<useFile>true</useFile>
										<printSummary>true</printSummary>
										<reportsDirectory>${project.build.directory}/surefire-integtest-reports</reportsDirectory>
										<forkCount>1</forkCount>
										<reuseForks>true</reuseForks>
										<argLine>${surefire-plugin.argLine}</argLine>
									</configuration>
								</execution>
                                <execution>
                                    <id>bdd-specs</id>
                                    <phase>integration-test</phase>
                                    <goals>
                                        <goal>test</goal>
                                    </goals>
                                    <configuration>
                                        <skipTests>${skipBDDs}</skipTests>
                                        <includes>
                                            <include>**/*Spec*.java</include>
                                        </includes>
                                        <excludes>
                                            <exclude>**/*Test.java</exclude>
                                            <exclude>**/*Testing.java</exclude>
                                            <exclude>**/*IntegTest*.java</exclude>
                                            <exclude>**/*Abstract*.java</exclude>
                                        </excludes>
                                        <useFile>true</useFile>
                                        <printSummary>true</printSummary>
                                        <reportsDirectory>${project.build.directory}/surefire-bddspecs-reports</reportsDirectory>
                                        <forkCount>1</forkCount>
                                        <reuseForks>true</reuseForks>
                                        <argLine>${surefire-plugin.argLine}</argLine>
                                    </configuration>
                                </execution>
							</executions>
						</plugin>
						<plugin>
							<groupId>org.apache.maven.plugins</groupId>
							<artifactId>maven-surefire-report-plugin</artifactId>
							<version>${maven-surefire-plugin.version}</version>
							<configuration>
								<showSuccess>false</showSuccess>
							</configuration>
							<executions>
								<execution>
									<id>test</id>
									<phase>test</phase>
								</execution>
								<execution>
									<id>integration-test</id>
                                    <phase>integration-test</phase>
                                </execution>
                                <execution>
                                    <id>bdd-specs</id>
									<phase>integration-test</phase>
								</execution>
							</executions>
						</plugin>
					</plugins>
				</pluginManagement>
			</build>
		</profile>

		<profile>
			<id>isis-app-starter-docker</id>
			<activation>
				<property>
					<name>!skip.isis-app-starter-docker</name>
				</property>
			</activation>
			<properties>
				<jib-maven-plugin.version>3.2.0</jib-maven-plugin.version>
			</properties>
			<build>
				<pluginManagement>
					<plugins>
						<plugin>
							<groupId>com.google.cloud.tools</groupId>
							<artifactId>jib-maven-plugin</artifactId>
							<version>${jib-maven-plugin.version}</version>
						</plugin>
					</plugins>
				</pluginManagement>
			</build>
		</profile>

		<!-- running: mvn spring-boot:run -->
		<profile>
			<id>isis-app-starter-boot</id>
			<activation>
				<property>
					<name>!skip.isis-app-starter-boot</name>
				</property>
			</activation>
			<properties>
			</properties>
			<build>
				<pluginManagement>
					<plugins>
						<plugin>
							<groupId>org.springframework.boot</groupId>
							<artifactId>spring-boot-maven-plugin</artifactId>
							<version>${spring-boot.version}</version>
							<executions>
								<execution>
									<goals>
										<goal>repackage</goal>
									</goals>
								</execution>
							</executions>
						</plugin>
					</plugins>
				</pluginManagement>
			</build>
		</profile>

		<profile>
			<id>apache-release</id>
			<activation>
				<property>
					<name>apache-release</name>
				</property>
			</activation>
			<properties>
				<skipTests>true</skipTests>
				<altDeploymentRepository>apache.releases.https::default::https://repository.apache.org/service/local/staging/deploy/maven2</altDeploymentRepository>
			</properties>
			<build>
				<plugins>
					<!-- We want to sign the artifact, the POM, and all attached artifacts -->
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-gpg-plugin</artifactId>
						<version>3.0.1</version>
						<executions>
							<execution>
								<id>sign-release-artifacts</id>
								<goals>
									<goal>sign</goal>
								</goals>
							</execution>
						</executions>
						<configuration>
							<gpgArguments>
								<arg>--digest-algo=SHA512</arg>
							</gpgArguments>
						</configuration>
					</plugin>
					<plugin>
						<groupId>net.nicoulaj.maven.plugins</groupId>
						<artifactId>checksum-maven-plugin</artifactId>
						<version>1.11</version>
						<executions>
							<execution>
								<id>source-release-checksum</id>
								<goals>
									<goal>files</goal>
								</goals>
							</execution>
						</executions>
						<configuration>
							<algorithms>
								<algorithm>SHA-512</algorithm>
							</algorithms>
							<csvSummary>false</csvSummary>
							<fileSets>
								<fileSet>
									<directory>${project.build.directory}</directory>
									<includes>
										<include>${project.artifactId}-${project.version}-source-release.zip</include>
										<include>${project.artifactId}-${project.version}-source-release.tar*</include>
									</includes>
								</fileSet>
							</fileSets>
							<failIfNoFiles>false</failIfNoFiles><!-- usually, no file to do checksum:
								don't consider error -->
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>

	</profiles>
</project>
