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

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

	<artifactId>neo4j-migrations-maven-plugin</artifactId>
	<packaging>maven-plugin</packaging>

	<name>Neo4j Migrations (Maven Plugin)</name>
	<description>Integration for Maven.</description>

	<prerequisites>
		<maven>${maven.version}</maven>
	</prerequisites>

	<properties>
		<commons-io.version>2.12.0</commons-io.version>
		<commons-lang3.version>3.12.0</commons-lang3.version>
		<covered-ratio-complexity>0.2</covered-ratio-complexity>
		<covered-ratio-instructions>0.2</covered-ratio-instructions>
		<ivy.version>2.5.1</ivy.version>
		<java-module-name>ac.simons.neo4j.migrations.maven</java-module-name>
		<junit.version>4.13.2</junit.version>
		<maven-plugin-annotations.version>3.9.0</maven-plugin-annotations.version>
		<maven-plugin-testing-harness.version>3.3.0</maven-plugin-testing-harness.version>
		<plexus-classworlds.version>2.7.0</plexus-classworlds.version>
		<plexus-component-annotations.version>2.1.1</plexus-component-annotations.version>
		<plexus-utils.version>3.5.1</plexus-utils.version>
		<sonar.coverage.jacoco.xmlReportPaths>${basedir}/../${aggregate.report.dir}</sonar.coverage.jacoco.xmlReportPaths>
	</properties>

	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>commons-io</groupId>
				<artifactId>commons-io</artifactId>
				<version>${commons-io.version}</version>
			</dependency>
			<dependency>
				<groupId>junit</groupId>
				<artifactId>junit</artifactId>
				<version>${junit.version}</version>
			</dependency>
			<dependency>
				<groupId>org.apache.commons</groupId>
				<artifactId>commons-lang3</artifactId>
				<version>${commons-lang3.version}</version>
			</dependency>
			<dependency>
				<groupId>org.apache.maven</groupId>
				<artifactId>maven-artifact</artifactId>
				<version>${maven.version}</version>
			</dependency>
			<dependency>
				<groupId>org.codehaus.plexus</groupId>
				<artifactId>plexus-classworlds</artifactId>
				<version>${plexus-classworlds.version}</version>
			</dependency>
			<dependency>
				<groupId>org.codehaus.plexus</groupId>
				<artifactId>plexus-component-annotations</artifactId>
				<version>${plexus-component-annotations.version}</version>
			</dependency>
			<dependency>
				<groupId>org.codehaus.plexus</groupId>
				<artifactId>plexus-utils</artifactId>
				<version>${plexus-utils.version}</version>
			</dependency>
		</dependencies>
	</dependencyManagement>

	<dependencies>
		<dependency>
			<groupId>eu.michael-simons.neo4j</groupId>
			<artifactId>neo4j-migrations</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>jul-to-slf4j</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.maven</groupId>
			<artifactId>maven-artifact</artifactId>
			<version>${maven.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.maven</groupId>
			<artifactId>maven-core</artifactId>
			<version>${maven.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.maven</groupId>
			<artifactId>maven-plugin-api</artifactId>
			<version>${maven.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.maven.plugin-tools</groupId>
			<artifactId>maven-plugin-annotations</artifactId>
			<version>${maven-plugin-annotations.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>com.github.stefanbirkner</groupId>
			<artifactId>system-lambda</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.maven</groupId>
			<artifactId>maven-compat</artifactId>
			<version>${maven.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.maven.plugin-testing</groupId>
			<artifactId>maven-plugin-testing-harness</artifactId>
			<version>${maven-plugin-testing-harness.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.assertj</groupId>
			<artifactId>assertj-core</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.mockito</groupId>
			<artifactId>mockito-core</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.mockito</groupId>
			<artifactId>mockito-inline</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-simple</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.testcontainers</groupId>
			<artifactId>junit-jupiter</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.testcontainers</groupId>
			<artifactId>neo4j</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.jacoco</groupId>
				<artifactId>jacoco-maven-plugin</artifactId>
				<configuration>
					<excludes>
						<exclude>**/HelpMojo.class</exclude>
					</excludes>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-plugin-plugin</artifactId>
				<configuration>
					<goalPrefix>neo4j-migrations</goalPrefix>
					<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
				</configuration>
				<executions>
					<execution>
						<id>mojo-descriptor</id>
						<goals>
							<goal>descriptor</goal>
						</goals>
					</execution>
					<execution>
						<id>help-goal</id>
						<goals>
							<goal>helpmojo</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>io.fabric8</groupId>
				<artifactId>docker-maven-plugin</artifactId>
				<version>${docker-maven-plugin.version}</version>
				<configuration>
					<images>
						<image>
							<name>${neo4j.image}</name>
							<run>
								<env>
									<NEO4J_AUTH>neo4j/secret</NEO4J_AUTH>
								</env>
								<wait>
									<log>http://localhost:7474/</log>
									<time>20000</time>
								</wait>
								<ports>
									<port>it-database-port:7687</port>
								</ports>
							</run>
						</image>
					</images>
				</configuration>
				<executions>
					<execution>
						<id>prepare-it-database</id>
						<goals>
							<goal>start</goal>
						</goals>
						<phase>pre-integration-test</phase>
					</execution>
					<execution>
						<id>remove-it-database</id>
						<goals>
							<goal>stop</goal>
						</goals>
						<phase>post-integration-test</phase>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-invoker-plugin</artifactId>
				<configuration>
					<debug>true</debug>
					<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
					<pomIncludes>
						<pomInclude>*/pom.xml</pomInclude>
					</pomIncludes>
					<scriptVariables>
						<address>bolt://localhost:${it-database-port}</address>
					</scriptVariables>
					<preBuildHookScript>prepare</preBuildHookScript>
					<postBuildHookScript>verify</postBuildHookScript>
					<properties>
						<it-database-port>${it-database-port}</it-database-port>
						<neo4j-migrations-maven-plugin.version>${project.version}</neo4j-migrations-maven-plugin.version>
					</properties>
					<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
					<settingsFile>src/it/settings.xml</settingsFile>
					<streamLogsOnFailures>true</streamLogsOnFailures>
					<goals>
						<goal>clean</goal>
						<goal>verify</goal>
					</goals>
				</configuration>
				<dependencies>
					<dependency>
						<groupId>org.apache.ivy</groupId>
						<artifactId>ivy</artifactId>
						<version>${ivy.version}</version>
					</dependency>
				</dependencies>
				<executions>
					<execution>
						<id>integration-test</id>
						<goals>
							<goal>install</goal>
							<goal>integration-test</goal>
							<goal>verify</goal>
						</goals>
						<phase>integration-test</phase>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<artifactId>maven-failsafe-plugin</artifactId>
				<configuration combine.self="append">
					<forkCount>1</forkCount>
					<reuseForks>false</reuseForks>
					<systemPropertyVariables>
						<migrations.default-neo4j-image>${neo4j.image}</migrations.default-neo4j-image>
					</systemPropertyVariables>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<reporting>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-javadoc-plugin</artifactId>
				<configuration>
					<skip>true</skip>
				</configuration>
				<reportSets/>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-plugin-plugin</artifactId>
			</plugin>
		</plugins>
	</reporting>
</project>
