<?xml version="1.0" encoding="UTF-8"?>
<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">
 	<prerequisites>
 		<maven>3.0</maven>
 	</prerequisites>
	<modelVersion>4.0.0</modelVersion>

	<groupId>com.inqwise.opinion</groupId>
	<artifactId>opinion-parent</artifactId>
	<packaging>pom</packaging>
	<description>Opinion - an advanced questionnaire platform, survey design, data analysis, market research, education, feedback collection</description>
	<version>1</version>
	
	<organization>
		<name>inqwise</name>
	</organization>
	
	<url>https://github.com/inqwise/opinion</url>
	
	<developers>
		<developer>
			<id>alex-inqwise</id>
            <name>Alex Misyuk</name>
            <email>alex@inqwise.com</email>
            <organization>inqwise</organization>
            <organizationUrl>https://www.inqwise.com</organizationUrl>
		</developer>
	</developers>
	
	<licenses>
		<license>
			<name>The Apache Software License, Version 2.0</name>
			<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
			<distribution>repo</distribution>
		</license>
	</licenses>

	<scm>
		<connection>scm:git:git@github.com:inqwise/opinion-parent.git</connection>
		<developerConnection>scm:git:git@github.com:inqwise/opinion-parent.git</developerConnection>
		<url>git@github.com:inqwise/opinion-parent.git</url>
	</scm>
	
	<repositories>
		<repository>
			<id>ossrh-snapshots</id>
			<name>Opinion Snapshots Repository</name>
			<url>https://oss.sonatype.org/content/repositories/snapshots</url>
			<releases>
				<enabled>false</enabled>
			</releases>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
		</repository>
	</repositories>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<maven.version>3.6.3</maven.version>
		<java.version>21</java.version>
		<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
		<junit5.version>5.10.1</junit5.version>
		<maven-flatten-plugin.version>1.5.0</maven-flatten-plugin.version>
		<maven.gpg.plugin.version>1.6</maven.gpg.plugin.version>
		<maven.javadoc.plugin.version>3.2.0</maven.javadoc.plugin.version>

		<project.tags>questionnaire, survey, data-analysis, market-research, education, feedback</project.tags>
	</properties>


	<build>
		<plugins>
			<plugin>
				<inherited>true</inherited>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-enforcer-plugin</artifactId>
				<version>3.3.0</version>
				<executions>
					<execution>
						<id>enforce-versions</id>
						<goals>
							<goal>enforce</goal>
						</goals>
						<configuration>
							<rules>
								<banDuplicatePomDependencyVersions/>
								<bannedPlugins>
									<!-- will only display a warning but does not fail the build. -->
									<level>WARN</level>
									<excludes>
										<exclude>org.apache.maven.plugins:maven-verifier-plugin</exclude>
									</excludes>
									<message>Please consider using the maven-invoker-plugin (http://maven.apache.org/plugins/maven-invoker-plugin/)!</message>
								</bannedPlugins>
								<requireMavenVersion>
									<version>${maven.version}</version>
								</requireMavenVersion>
								<requireJavaVersion>
										<version>${java.version}</version>
								</requireJavaVersion>
							</rules>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<version>3.1.2</version>
				<dependencies>
					<dependency>
						<groupId>org.junit.jupiter</groupId>
						<artifactId>junit-jupiter-engine</artifactId>
						<version>${junit5.version}</version>
					</dependency>
				</dependencies>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-source-plugin</artifactId>
				<version>3.3.0</version>
				<executions>
					<execution>
						<id>attach-sources</id>
						<goals>
							<goal>jar</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
			</plugin>
		</plugins>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-clean-plugin</artifactId>
					<version>3.3.1</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-deploy-plugin</artifactId>
					<version>3.1.1</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-install-plugin</artifactId>
					<version>3.1.1</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-site-plugin</artifactId>
					<version>3.12.1</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-compiler-plugin</artifactId>
					<version>${maven-compiler-plugin.version}</version>
					<configuration>
						<forceJavacCompilerUse>true</forceJavacCompilerUse>
						<release>${java.version}</release>
						<generatedSourcesDirectory>src/main/generated</generatedSourcesDirectory>
						<generatedTestSourcesDirectory>src/test/generated</generatedTestSourcesDirectory>
					</configuration>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-shade-plugin</artifactId>
					<version>3.5.0</version>
					<executions>
						<execution>
							<phase>package</phase>
							<goals>
								<goal>shade</goal>
							</goals>
							<configuration>
								<outputFile>${project.build.directory}/${project.artifactId}-fat.jar</outputFile>
							</configuration>
						</execution>
					</executions>
					<dependencies>
						<dependency>
							<groupId>com.github.edwgiz</groupId>
							<artifactId>maven-shade-plugin.log4j2-cachefile-transformer</artifactId>
							<version>2.15</version>
						</dependency>
					</dependencies>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-gpg-plugin</artifactId>
					<version>${maven.gpg.plugin.version}</version>
				</plugin>
			</plugins>
		</pluginManagement>
	</build>
	
	<profiles>
		<profile>
			<id>sonatype-oss-release</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.sonatype.central</groupId>
						<artifactId>central-publishing-maven-plugin</artifactId>
						<version>0.1.6</version>
						<extensions>true</extensions>
						<configuration>
							<publishingServerId>opinion-sonatype</publishingServerId>
							<tokenEnabled>true</tokenEnabled>
						</configuration>
					</plugin>
					<!-- Set plugin version due to wrong plugin version when activating this profile -->
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-javadoc-plugin</artifactId>
						<version>${maven.javadoc.plugin.version}</version>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-gpg-plugin</artifactId>
						<executions>
							<execution>
								<id>sign-artifacts</id>
								<phase>verify</phase>
								<goals>
									<goal>sign</goal>
								</goals>
								<configuration>
									<gpgArguments>
    									<arg>--pinentry-mode</arg>
    									<arg>loopback</arg>
  									</gpgArguments>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-enforcer-plugin</artifactId>
						<executions>
							<execution>
								<id>enforce-no-vertx-snapshots</id>
								<goals>
									<goal>enforce</goal>
								</goals>
								<configuration>
									<rules>
										<requireJavaVersion>
											<message>Opinion must be released with Java 21!</message>
											<version>[21,)</version>
										</requireJavaVersion>
										<requireReleaseDeps>
											<message>No Opinion Snapshots Allowed during a release!</message>
											<includes>
												<include>com.inqwise.opinion:*</include>
											</includes>
										</requireReleaseDeps>
									</rules>
									<fail>true</fail>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>
</project>
