<?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">
	<modelVersion>4.0.0</modelVersion>

	<groupId>com.inqwise.opinion</groupId>
	<artifactId>opinion-parent</artifactId>
	<packaging>pom</packaging>
	<name>Opinion Parent</name>
	<description>Opinion - an advanced questionnaire platform, survey design, data analysis, market research, education, feedback collection</description>
	<version>7</version>

	<organization>
		<name>inqwise</name>
	</organization>

	<url>https://github.com/inqwise-opinion/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:https://github.com/inqwise-opinion/opinion-parent.git</connection>
		<developerConnection>scm:git:https://github.com/inqwise-opinion/opinion-parent.git</developerConnection>
		<url>https://github.com/inqwise-opinion/opinion-parent</url>
		<tag>v7</tag>
	</scm>

	<distributionManagement>
		<repository>
			<id>sonatype-oss-release</id>
			<name>Central Repository</name>
			<url>https://central.sonatype.com/api/v1/publisher</url>
		</repository>
		<snapshotRepository>
			<id>sonatype-oss-snapshots</id>
			<name>Central Repository Snapshots</name>
			<url>https://central.sonatype.com/repository/maven-snapshots/</url>
		</snapshotRepository>
	</distributionManagement>

	<repositories>
 		<repository>
			<name>Central Portal Snapshots</name>
			<id>central-portal-snapshots</id>
			<url>https://central.sonatype.com/repository/maven-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.14.1</maven-compiler-plugin.version>
		<junit5.version>6.0.0</junit5.version>
		<maven-flatten-plugin.version>1.7.3</maven-flatten-plugin.version>
		<maven.gpg.plugin.version>3.2.8</maven.gpg.plugin.version>
		<maven.javadoc.plugin.version>3.12.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.6.2</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.5.4</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.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-compiler-plugin</artifactId>
			</plugin>
			<plugin>
				<artifactId>maven-clean-plugin</artifactId>
				<configuration>
					<filesets>
						<fileset>
							<directory>${basedir}</directory>
							<includes>
								<include>**/*.log</include>
								<include>**/generated/**</include>
								<include>**/.flattened-pom.xml</include>
								<include>**/target/**</include>
							</includes>
						</fileset>
					</filesets>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>flatten-maven-plugin</artifactId>
				<version>${maven-flatten-plugin.version}</version>
				<configuration>
					<updatePomFile>true</updatePomFile>
					<flattenMode>resolveCiFriendliesOnly</flattenMode>
				</configuration>
				<executions>
					<execution>
						<id>flatten</id>
						<phase>process-resources</phase>
						<goals>
							<goal>flatten</goal>
						</goals>
					</execution>
					<execution>
						<id>flatten.clean</id>
						<phase>clean</phase>
						<goals>
							<goal>clean</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-clean-plugin</artifactId>
					<version>3.5.0</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-deploy-plugin</artifactId>
					<version>3.1.4</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-install-plugin</artifactId>
					<version>3.1.4</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-site-plugin</artifactId>
					<version>3.21.0</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-release-plugin</artifactId>
					<version>3.1.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.6.1</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.9.0</version>
						<extensions>true</extensions>
						<configuration>
							<publishingServerId>sonatype-oss-release</publishingServerId>
							<autoPublish>true</autoPublish>
							<checksums>required</checksums>
						<project>
							<name>${project.name}</name>
							<description>${project.description}</description>
							<url>${project.url}</url>
						</project>
						</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>
						<version>${maven.gpg.plugin.version}</version>
						<executions>
							<execution>
								<id>sign-artifacts</id>
								<phase>verify</phase>
								<goals>
									<goal>sign</goal>
								</goals>
							</execution>
						</executions>
						<configuration>
							<gpgArguments>
								<arg>--pinentry-mode</arg>
								<arg>loopback</arg>
							</gpgArguments>
						</configuration>
					</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>
		<profile>
			<id>display-updates</id>
			<build>
				<plugins>
					<plugin>
					    <groupId>org.codehaus.mojo</groupId>
					    <artifactId>versions-maven-plugin</artifactId>
					    <version>2.19.1</version>
					    <configuration>
					        <rulesUri>https://raw.githubusercontent.com/inqwise-opinion/opinion-parent/main/maven-version-rules.xml</rulesUri>
					    </configuration>
					    <executions>
					        <execution>
					        <phase>compile</phase>
					        <goals>
					            <goal>display-dependency-updates</goal>
					            <goal>display-plugin-updates</goal>
					        </goals>
					        </execution>
					    </executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>
</project>
