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

    Copyright 2020-2023 the original author or authors.

    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

         https://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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>eu.michael-simons.neo4j</groupId>
		<artifactId>neo4j-migrations-quarkus-parent</artifactId>
		<version>2.3.0</version>
	</parent>

	<artifactId>neo4j-migrations-quarkus-deployment</artifactId>

	<name>Neo4j Migrations (Quarkus Deployment)</name>
	<description>Deployment steps for the Quarkus integration of Neo4j Migrations.</description>

	<properties>
		<java-module-name>ac.simons.neo4j.migrations.quarkus.deployment</java-module-name>
		<sonar.coverage.jacoco.xmlReportPaths>${basedir}/../../${aggregate.report.dir}</sonar.coverage.jacoco.xmlReportPaths>
	</properties>

	<dependencies>
		<dependency>
			<groupId>eu.michael-simons.neo4j</groupId>
			<artifactId>neo4j-migrations-quarkus</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>io.quarkiverse.neo4j</groupId>
			<artifactId>quarkus-neo4j-deployment</artifactId>
		</dependency>
		<dependency>
			<groupId>io.quarkus</groupId>
			<artifactId>quarkus-arc-deployment</artifactId>
		</dependency>
		<dependency>
			<groupId>io.quarkus</groupId>
			<artifactId>quarkus-junit5-internal</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>io.quarkus</groupId>
			<artifactId>quarkus-resteasy</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>io.rest-assured</groupId>
			<artifactId>rest-assured</artifactId>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<groupId>org.apache.commons</groupId>
					<artifactId>commons-lang3</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.assertj</groupId>
			<artifactId>assertj-core</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.jacoco</groupId>
			<artifactId>org.jacoco.agent</artifactId>
			<version>${jacoco-maven-plugin.version}</version>
			<classifier>runtime</classifier>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.testcontainers</groupId>
			<artifactId>junit-jupiter</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.jacoco</groupId>
				<artifactId>jacoco-maven-plugin</artifactId>
				<executions>
					<!-- Sadly, the instrumentation is necessary twice, as the instrumented classes would end up in the jar files other wise -->
					<execution>
						<id>instrument-ut</id>
						<goals>
							<goal>instrument</goal>
						</goals>
					</execution>
					<execution>
						<id>restore-ut</id>
						<goals>
							<goal>restore-instrumented-classes</goal>
						</goals>
					</execution>
					<execution>
						<id>instrument-it</id>
						<goals>
							<goal>instrument</goal>
						</goals>
						<phase>pre-integration-test</phase>
					</execution>
					<execution>
						<id>report-and-check</id>
						<goals>
							<goal>restore-instrumented-classes</goal>
							<!-- Those are configured in the main parent pom, need to be repeated here, so that the restauration of the instrumented classes happens before -->
							<goal>report</goal>
							<goal>check</goal>
						</goals>
						<phase>post-integration-test</phase>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration combine.self="append">
					<annotationProcessorPaths>
						<path>
							<groupId>io.quarkus</groupId>
							<artifactId>quarkus-extension-processor</artifactId>
							<version>${quarkus.version}</version>
						</path>
					</annotationProcessorPaths>
					<compilerArgs>
						<!--
							Compilation fails when enabling class file validation
							vertx-web-4.3.2.jar(/io/vertx/ext/web/RoutingContext.class): warning: Cannot find annotation method 'value()' in type 'GenIgnore'
						-->
						<arg>-Xlint:all,-options,-path,-processing,-classfile</arg>
						<arg>-Werror</arg>
						<arg>-parameters</arg>
					</compilerArgs>
				</configuration>
			</plugin>
			<plugin>
				<artifactId>maven-javadoc-plugin</artifactId>
				<configuration combine.self="append">
					<!-- That will cause generated sources to be ignored -->
					<sourcepath>${project.build.sourceDirectory}</sourcepath>
				</configuration>
			</plugin>
			<plugin>
				<artifactId>maven-surefire-plugin</artifactId>
				<configuration combine.self="append">
					<argLine>-Xverify:all</argLine>
					<systemPropertyVariables>
						<jacoco-agent.destfile>${project.build.directory}/jacoco.exec</jacoco-agent.destfile>
						<jacoco-agent.append>true</jacoco-agent.append>
					</systemPropertyVariables>
				</configuration>
			</plugin>
			<plugin>
				<artifactId>maven-failsafe-plugin</artifactId>
				<configuration combine.self="append">
					<argLine>-Xverify:all</argLine>
					<classesDirectory>${project.build.outputDirectory}</classesDirectory>
					<systemPropertyVariables>
						<jacoco-agent.destfile>${project.build.directory}/jacoco.exec</jacoco-agent.destfile>
						<jacoco-agent.append>true</jacoco-agent.append>
						<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
						<maven.home>${maven.home}</maven.home>
					</systemPropertyVariables>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>
