<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>de.tudresden.inf.st</groupId>
	<artifactId>salespoint-framework</artifactId>
	<version>9.0.1</version>

	<name>Salespoint</name>

	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>3.1.4</version>
		<relativePath />
	</parent>

	<properties>
		<dev>/dev</dev>
		<java.version>17</java.version>
		<jmolecules.version>2023.1.0</jmolecules.version>
		<spring-modulith.version>1.0.0</spring-modulith.version>
		<spring-asciidoctor-backends.version>0.0.7</spring-asciidoctor-backends.version>
	</properties>

	<profiles>
		<profile>
			<id>release</id>
			<properties>
				<dev />
			</properties>
		</profile>
		<profile>
			<id>docs</id>
			<build>
				<plugins>

					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-surefire-plugin</artifactId>
						<configuration combine.self="override">
							<includes>
								<include>**/DocumentationTests.java</include>
							</includes>
						</configuration>
					</plugin>

					<plugin>
						<groupId>org.asciidoctor</groupId>
						<artifactId>asciidoctor-maven-plugin</artifactId>
						<version>2.2.4</version>
						<dependencies>
							<dependency>
								<groupId>org.asciidoctor</groupId>
								<artifactId>asciidoctorj</artifactId>
								<version>2.5.10</version>
							</dependency>
							<dependency>
								<groupId>org.asciidoctor</groupId>
								<artifactId>asciidoctorj-diagram</artifactId>
								<version>2.2.11</version>
							</dependency>
							<dependency>
								<groupId>io.spring.asciidoctor.backends</groupId>
								<artifactId>spring-asciidoctor-backends</artifactId>
								<version>${spring-asciidoctor-backends.version}</version>
							</dependency>
						</dependencies>
						<executions>
							<execution>
								<id>website</id>
								<phase>package</phase>
								<goals>
									<goal>process-asciidoc</goal>
								</goals>
								<configuration>
									<sourceDirectory>src/main/asciidoc/site</sourceDirectory>
									<outputDirectory>${project.build.directory}/site</outputDirectory>
								</configuration>
							</execution>
							<execution>
								<id>reference</id>
								<phase>package</phase>
								<goals>
									<goal>process-asciidoc</goal>
								</goals>
								<configuration>
									<sourceDirectory>src/main/asciidoc</sourceDirectory>
									<sourceDocumentName>salespoint-reference.adoc</sourceDocumentName>
									<outputDirectory>${project.build.directory}/site${dev}</outputDirectory>
									<requires>
										<require>asciidoctor-diagram</require>
									</requires>
								</configuration>
							</execution>
						</executions>
						<configuration>
							<doctype>book</doctype>
							<backend>spring-html</backend>
							<resources>
								<!-- Copy our own resources first to make sure they trump the others -->

							</resources>
							<attributes>
								<dev>${dev}</dev>
								<highlightjsdir>js/highlight</highlightjsdir>
								<source-highlighter>highlight.js</source-highlighter>
								<stylesheet>salespoint.css</stylesheet>
								<toc>left</toc>
								<version>${project.version}</version>
							</attributes>
						</configuration>
					</plugin>

					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-site-plugin</artifactId>
						<configuration>
							<chmod>false</chmod>
						</configuration>
					</plugin>

				</plugins>
			</build>
		</profile>
	</profiles>

	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.jmolecules</groupId>
				<artifactId>jmolecules-bom</artifactId>
				<version>${jmolecules.version}</version>
				<scope>import</scope>
				<type>pom</type>
			</dependency>
		</dependencies>
	</dependencyManagement>

	<dependencies>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-data-jpa</artifactId>
		</dependency>

		<dependency>
			<groupId>com.querydsl</groupId>
			<artifactId>querydsl-jpa</artifactId>
			<classifier>jakarta</classifier>
			<version>${querydsl.version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-thymeleaf</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-mail</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-security</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-configuration-processor</artifactId>
			<optional>true</optional>
		</dependency>

		<dependency>
			<groupId>org.thymeleaf.extras</groupId>
			<artifactId>thymeleaf-extras-springsecurity6</artifactId>
		</dependency>

		<!-- Fix "unknown enum constant javax.annotation.meta.When.MAYBE" warnings -->
		<dependency>
			<groupId>com.google.code.findbugs</groupId>
			<artifactId>jsr305</artifactId>
			<version>3.0.2</version>
			<scope>provided</scope>
		</dependency>

		<!-- Test -->

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.hamcrest</groupId>
			<artifactId>hamcrest-junit</artifactId>
			<version>2.0.0.0</version>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<groupId>junit</groupId>
					<artifactId>junit</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<dependency>
			<groupId>com.h2database</groupId>
			<artifactId>h2</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.javamoney.moneta</groupId>
			<artifactId>moneta-core</artifactId>
			<version>1.4.2</version>
		</dependency>

		<!-- For changelog creation -->

		<dependency>
			<groupId>org.apache.httpcomponents.client5</groupId>
			<artifactId>httpclient5</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<scope>provided</scope>
		</dependency>

		<!-- Architecture -->

		<dependency>
			<groupId>org.springframework.modulith</groupId>
			<artifactId>spring-modulith-api</artifactId>
			<version>${spring-modulith.version}</version>
		</dependency>

		<dependency>
			<groupId>org.springframework.modulith</groupId>
			<artifactId>spring-modulith-starter-test</artifactId>
			<version>${spring-modulith.version}</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.jmolecules.integrations</groupId>
			<artifactId>jmolecules-starter-ddd</artifactId>
		</dependency>

		<dependency>
			<groupId>org.jmolecules.integrations</groupId>
			<artifactId>jmolecules-spring</artifactId>
		</dependency>

	</dependencies>

	<build>

		<defaultGoal>verify</defaultGoal>

		<extensions>
			<extension>
				<groupId>org.apache.maven.wagon</groupId>
				<artifactId>wagon-ssh</artifactId>
				<version>3.4.3</version>
			</extension>
		</extensions>

		<plugins>

			<plugin>
				<groupId>com.mysema.maven</groupId>
				<artifactId>apt-maven-plugin</artifactId>
				<version>1.1.3</version>
				<executions>
					<execution>
						<phase>generate-sources</phase>
						<goals>
							<goal>process</goal>
						</goals>
						<configuration>
							<outputDirectory>target/generated-sources/queries</outputDirectory>
							<processors>
								<processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
								<processor>lombok.launch.AnnotationProcessorHider$AnnotationProcessor</processor>
							</processors>
						</configuration>
					</execution>
				</executions>
				<dependencies>
					<dependency>
						<groupId>com.querydsl</groupId>
						<artifactId>querydsl-apt</artifactId>
						<classifier>jakarta</classifier>
						<version>${querydsl.version}</version>
					</dependency>
				</dependencies>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<configuration>
					<excludes>
						<exclude>**/DocumentationTests.java</exclude>
					</excludes>
				</configuration>
			</plugin>

			<!-- Delombok sources to make sure generated methods can be picked up by JavaDoc -->
			<plugin>
				<groupId>org.projectlombok</groupId>
				<artifactId>lombok-maven-plugin</artifactId>
				<version>1.18.20.0</version>
				<configuration>
					<addOutputDirectory>false</addOutputDirectory>
					<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
				</configuration>
				<executions>
					<execution>
						<phase>generate-sources</phase>
						<goals>
							<goal>delombok</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-javadoc-plugin</artifactId>
				<executions>
					<execution>
						<id>package-javadoc</id>
						<goals>
							<goal>jar</goal>
						</goals>
						<phase>package</phase>
					</execution>
				</executions>
				<configuration>
					<doclint>all,-missing</doclint>
					<quiet>true</quiet>
					<failOnError>true</failOnError>
					<failOnWarnings>true</failOnWarnings>
					<tags>
						<!-- @soundtrack doctag can be used, but won't show up in generated docs -->
						<tag>
							<name>soundtrack</name>
							<placement>X</placement>
						</tag>
					</tags>
					<outputDirectory>${project.build.directory}/site${dev}/api</outputDirectory>
					<sourcepath>target/generated-sources/delombok</sourcepath>
					<links>
						<link>https://docs.spring.io/spring-data/commons/docs/current/api</link>
						<link>https://docs.spring.io/spring-framework/docs/${spring-framework.version}/javadoc-api/</link>
						<!--
							Adding this breaks Javadoc generation

						- https://bugs.openjdk.java.net/browse/JDK-8240169 (fixed in JDK 15 but…)
						- https://github.com/rzwitserloot/lombok/issues/2586

						<link>https://javamoney.github.io/apidocs</link>
						<link>https://docs.oracle.com/javaee/7/api</link>

						-->
					</links>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-release-plugin</artifactId>
				<version>3.0.1</version>
				<configuration>
					<pushChanges>false</pushChanges>
					<scmCommentPrefix />
					<tagNameFormat>${project.version}</tagNameFormat>
					<releaseProfiles>release</releaseProfiles>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-source-plugin</artifactId>
				<executions>
					<execution>
						<id>attach-sources</id>
						<goals>
							<goal>jar-no-fork</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

		</plugins>
	</build>

	<scm>
		<url>https://github.com/st-tu-dresden/salespoint</url>
		<connection>scm:git:https://github.com/st-tu-dresden/salespoint</connection>
		<tag>9.0.1</tag>
	</scm>

	<distributionManagement>
		<repository>
			<id>salespoint</id>
			<url>sftp://st.inf.tu-dresden.de:44/home/salespnt/salespoint/repository</url>
		</repository>
		<site>
			<id>salespoint</id>
			<url>sftp://st.inf.tu-dresden.de:44/home/salespnt/salespoint</url>
		</site>
	</distributionManagement>

	<repositories>
		<repository>
			<id>salespointframework</id>
			<url>https://www.st.inf.tu-dresden.de/SalesPoint/repository</url>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
		</repository>
	</repositories>

</project>
