<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>4.0.2</version>
		<relativePath />
	</parent>
	<groupId>com.innogon</groupId>
	<artifactId>springsearchjpa</artifactId>
	<version>1.0.0</version>
	<name>springsearchjpa</name>
	<description>API for generating spring boot database queries</description>
	<url>https://github.com/yusufsahin/springsearchjpa</url>

	<licenses>
		<license>
			<name>Apache License, Version 2.0</name>
			<url>https://www.apache.org/licenses/LICENSE-2.0</url>
			<distribution>repo</distribution>
		</license>
	</licenses>

	<developers>
		<developer>
			<name>Yusuf Sahin</name>
			<email>yusuf@yusufsahin.net</email>
			<organization>Innogon</organization>
			<organizationUrl>https://github.com/yusufsahin</organizationUrl>
		</developer>
	</developers>

	<scm>
		<connection>scm:git:git://github.com/yusufsahin/springsearchjpa.git</connection>
		<developerConnection>scm:git:ssh://github.com:yusufsahin/springsearchjpa.git</developerConnection>
		<url>https://github.com/yusufsahin/springsearchjpa</url>
	</scm>

	<properties>
		<java.version>17</java.version>
		<jacoco-maven-plugin.version>0.8.14</jacoco-maven-plugin.version>
		<h2.version>2.4.240</h2.version>
		<antlr4.version>4.13.2</antlr4.version>
		<grammar.package>com.innogon.springsearchjpa.grammar</grammar.package>
		<grammar.directory>com/innogon/springsearchjpa/grammar</grammar.directory>
		<project.testresult.directory>${project.build.directory}/test-results</project.testresult.directory>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-data-jpa</artifactId>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>com.h2database</groupId>
			<artifactId>h2</artifactId>
			<version>${h2.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-data-rest</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.antlr</groupId>
			<artifactId>antlr4-runtime</artifactId>
			<version>${antlr4.version}</version>
		</dependency>
	</dependencies>

	<build>
		<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
		<testSourceDirectory>src/test/java</testSourceDirectory>
		<plugins>
			<plugin>
				<groupId>org.antlr</groupId>
				<artifactId>antlr4-maven-plugin</artifactId>
				<version>${antlr4.version}</version>
				<executions>
					<execution>
						<id>antlr</id>
						<goals>
							<goal>antlr4</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<listener>true</listener>
					<visitor>true</visitor>
					<arguments>
						<argument>-package</argument>
						<argument>${grammar.package}</argument>
					</arguments>
					<outputDirectory>${project.build.directory}/generated-sources/antlr4/${grammar.directory}</outputDirectory>
				</configuration>
			</plugin>

			<plugin>
				<artifactId>maven-release-plugin</artifactId>
				<version>2.5.3</version>
				<configuration>
					<useReleaseProfile>false</useReleaseProfile>
					<releaseProfiles>release</releaseProfiles>
					<autoVersionSubmodules>true</autoVersionSubmodules>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.jacoco</groupId>
				<artifactId>jacoco-maven-plugin</artifactId>
				<version>${jacoco-maven-plugin.version}</version>
				<configuration>
				<excludes>
					<exclude>${grammar.directory}/**/*</exclude>
					<exclude>Query*</exclude>
					<exclude>com/innogon/springsearchjpa/exception/**/*</exclude>
				</excludes>
				</configuration>
				<executions>
					<execution>
						<id>pre-unit-tests</id>
						<goals>
							<goal>prepare-agent</goal>
						</goals>
						<configuration>
							<destFile>${project.testresult.directory}/coverage/jacoco/jacoco.exec</destFile>
						</configuration>
					</execution>
					<execution>
						<id>post-unit-test</id>
						<phase>test</phase>
						<goals>
							<goal>report</goal>
						</goals>
						<configuration>
							<dataFile>${project.testresult.directory}/coverage/jacoco/jacoco.exec</dataFile>
							<outputDirectory>${project.testresult.directory}/coverage/jacoco</outputDirectory>
						</configuration>
					</execution>
					<execution>
						<id>jacoco-check</id>
						<phase>test</phase>
						<goals>
							<goal>check</goal>
						</goals>
						<configuration>
							<dataFile>${project.testresult.directory}/coverage/jacoco/jacoco.exec</dataFile>
							<rules>
								<rule implementation="org.jacoco.maven.RuleConfiguration">
									<element>BUNDLE</element>
									<limits>
										<limit implementation="org.jacoco.report.check.Limit">
											<counter>INSTRUCTION</counter>
											<value>COVEREDRATIO</value>
											<minimum>0.80</minimum>
										</limit>
										<limit implementation="org.jacoco.report.check.Limit">
											<counter>BRANCH</counter>
											<value>COVEREDRATIO</value>
											<minimum>0.75</minimum>
										</limit>
									</limits>
								</rule>
							</rules>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.15.0</version>
				<executions>
					<execution>
						<id>compile</id>
						<phase>compile</phase>
						<goals>
							<goal>compile</goal>
						</goals>
					</execution>
					<execution>
						<id>testCompile</id>
						<phase>test-compile</phase>
						<goals>
							<goal>testCompile</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<artifactId>maven-source-plugin</artifactId>
				<executions>
					<execution>
						<id>attach-sources</id>
						<phase>package</phase>
						<goals>
							<goal>jar-no-fork</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<artifactId>maven-javadoc-plugin</artifactId>
				<executions>
					<execution>
						<id>attach-javadocs</id>
						<phase>package</phase>
						<goals>
							<goal>jar</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<failOnError>false</failOnError>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.sonatype.central</groupId>
				<artifactId>central-publishing-maven-plugin</artifactId>
				<version>0.7.0</version>
				<extensions>true</extensions>
				<configuration>
					<publishingServerId>central</publishingServerId>
					<autoPublish>true</autoPublish>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<profiles>
		<profile>
			<id>release</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-gpg-plugin</artifactId>
						<version>3.2.7</version>
						<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>
				</plugins>
			</build>
		</profile>
	</profiles>
</project>
