<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2025. Jo Rabin
  ~
  ~ 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
  ~
  ~      http://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>

	<groupId>org.linguafranca.pwdb</groupId>
	<artifactId>KeePassJava2.parent</artifactId>
	<version>3.1.0</version>
	<modules>
		<module>database</module>
		<module>test</module>
		<module>kdb</module>
		<module>kdbx-io</module>
		<module>kdbx-database</module>
		<module>all</module>
		<module>example</module>
		<module>basic</module>
	</modules>
	<packaging>pom</packaging>

	<name>KeePassJava2</name>
	<description>A Java 17 API for databases compatible with the renowned KeePass password safe for Windows</description>
	<url>https://github.com/jorabin/KeePassJava2</url>

	<licenses>
		<license>
			<name>Apache License, Version 2.0</name>
			<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
			<distribution>repo</distribution>
		</license>
	</licenses>

	<scm>
		<connection>scm:git:git://github.com/jorabin/KeePassJava2.git</connection>
		<developerConnection>scm:git:git@github.com:jorabin/KeePassJava2.git</developerConnection>
		<url>https://github.com/jorabin/KeePassJava2</url>
		<tag>KeePassJava2-3.1.0</tag>
	</scm>

	<developers>
		<developer>
			<name>Jo Rabin</name>
			<timezone>Europe/London</timezone>
			<url>https://www.linkedin.com/in/jorabin</url>
			<roles>
				<role>Creator</role>
			</roles>
		</developer>
	</developers>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<java.version>17</java.version>
		<!-- modules that are published set their own, see #93 -->
		<automatic-module-name>${project.groupId}.${project.artifactId}</automatic-module-name>
		<!-- used by the modules that depend on Jackson -->
		<jackson.version>2.22.3</jackson.version>
		<woodstox.version>7.3.0</woodstox.version>
		<!-- javadoc checks in the releaseToMaven profile -->
		<javadoc.doclint>html,syntax</javadoc.doclint>

		<maven-compiler-plugin.version>3.16.0</maven-compiler-plugin.version>
		<maven-surefire-plugin.version>3.6.0</maven-surefire-plugin.version>
		<central-publishing-maven-plugin.version>0.11.0</central-publishing-maven-plugin.version>
		<maven-source-plugin.version>3.4.0</maven-source-plugin.version>
		<maven-javadoc-plugin.version>3.12.0</maven-javadoc-plugin.version>
		<maven-gpg-plugin.version>3.2.8</maven-gpg-plugin.version>
		<maven-release-plugin.version>3.3.1</maven-release-plugin.version>
		<maven-jar-plugin.version>3.5.1</maven-jar-plugin.version>
		<maven-dependency-plugin.version>3.11.0</maven-dependency-plugin.version>
		<maven-clean-plugin.version>3.5.0</maven-clean-plugin.version>
		<versions-maven-plugin.version>2.22.0</versions-maven-plugin.version>
		<maven-enforcer-plugin.version>3.6.3</maven-enforcer-plugin.version>

		<!-- reduce the chattiness of output - see profile of same name below -->
		<inhibitConsoleOutput>false</inhibitConsoleOutput>
	</properties>

	<build>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-surefire-plugin</artifactId>
					<version>${maven-surefire-plugin.version}</version>
					<configuration>
						<useSystemClassLoader>false</useSystemClassLoader>
						<systemPropertyVariables>
							<!-- set Java system property to maven property, set in eponymous profile, below -->
							<inhibitConsoleOutput>${inhibitConsoleOutput}</inhibitConsoleOutput>
							<!-- this tells all tests run via surefire to pick their logback config up from the root -->
							<!-- fwiw does not affect those run  by other means which need to find their config somehow else-->
							<!--suppress UnresolvedMavenProperty -->
							<logback.configurationFile>${maven.multiModuleProjectDirectory}/logback.xml</logback.configurationFile>
						</systemPropertyVariables>
					</configuration>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-jar-plugin</artifactId>
					<version>${maven-jar-plugin.version}</version>
					<configuration>
						<archive>
							<manifestEntries>
								<Automatic-Module-Name>${automatic-module-name}</Automatic-Module-Name>
							</manifestEntries>
						</archive>
					</configuration>
				</plugin>
				<plugin>
					<groupId>org.codehaus.mojo</groupId>
					<artifactId>versions-maven-plugin</artifactId>
					<version>${versions-maven-plugin.version}</version>
				</plugin>
			</plugins>
		</pluginManagement>

		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>${maven-compiler-plugin.version}</version>
				<configuration>
					<!-- checks against the Java 17 API, so the jars run on Java 17 whichever JDK builds them -->
					<release>${java.version}</release>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-release-plugin</artifactId>
				<version>${maven-release-plugin.version}</version>
				<configuration>
					<autoVersionSubmodules>true</autoVersionSubmodules>
					<useReleaseProfile>false</useReleaseProfile>
					<releaseProfiles>releaseToMaven</releaseProfiles>
					<goals>deploy</goals>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<version>${maven-dependency-plugin.version}</version>
			</plugin>
			<plugin>
				<artifactId>maven-clean-plugin</artifactId>
				<version>${maven-clean-plugin.version}</version>
				<configuration>
					<filesets>
						<fileset>
							<directory>testOutput</directory>
							<followSymlinks>false</followSymlinks>
						</fileset>
					</filesets>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.sonatype.central</groupId>
				<artifactId>central-publishing-maven-plugin</artifactId>
				<version>${central-publishing-maven-plugin.version}</version>
				<extensions>true</extensions>
				<configuration>
					<publishingServerId>central</publishingServerId>
					<!-- only needed to build and test this project; the plugin ignores maven.deploy.skip -->
					<excludeArtifacts>
						<artifact>example</artifact>
						<artifact>basic</artifact>
						<artifact>test</artifact>
					</excludeArtifacts>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-enforcer-plugin</artifactId>
				<version>${maven-enforcer-plugin.version}</version>
				<executions>
					<execution>
						<id>enforce-maven</id>
						<goals>
							<goal>enforce</goal>
						</goals>
						<configuration>
							<rules>
								<!-- for some plugins -->
								<requireMavenVersion>
									<version>3.6.3</version>
								</requireMavenVersion>
								<requireJavaVersion>
									<version>[17,)</version>
									<message>Build with JDK 17 or later.</message>
								</requireJavaVersion>
							</rules>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

	<dependencies>
		<dependency>
			<groupId>org.jetbrains</groupId>
			<artifactId>annotations</artifactId>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.junit.platform</groupId>
			<artifactId>junit-platform-launcher</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter-engine</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>ch.qos.logback</groupId>
			<artifactId>logback-classic</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.jetbrains</groupId>
				<artifactId>annotations</artifactId>
				<version>26.1.0</version>
			</dependency>
			<dependency>
				<groupId>com.google.guava</groupId>
				<artifactId>guava</artifactId>
				<version>33.7.2-jre</version>
			</dependency>
			<dependency>
				<groupId>org.bouncycastle</groupId>
				<artifactId>bcpkix-jdk18on</artifactId>
				<version>1.86</version>
			</dependency>
			<dependency>
				<groupId>org.slf4j</groupId>
				<artifactId>slf4j-api</artifactId>
				<version>2.0.17</version>
			</dependency>
			<!-- if you want to use logback versions from 1.2 on you need to use
				SLF4J > 2.0, this was kind of hard to find out. -->
			<dependency>
				<groupId>ch.qos.logback</groupId>
				<artifactId>logback-classic</artifactId>
				<version>1.6.5</version>
			</dependency>
			<dependency>
				<groupId>commons-codec</groupId>
				<artifactId>commons-codec</artifactId>
				<version>1.22.1</version>
			</dependency>
			<dependency>
				<groupId>org.junit</groupId>
				<artifactId>junit-bom</artifactId>
				<version>5.14.4</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
		</dependencies>
	</dependencyManagement>

	<profiles>
		<profile>
			<!-- this is a profile that can be activated to inhibit console output from tests -->
			<id>inhibitConsoleOutput</id>
			<properties>
				<inhibitConsoleOutput>true</inhibitConsoleOutput>
			</properties>
		</profile>
		<profile>
			<!-- used for the actual release - mvn clean deploy -P releaseToMaven,inhibitConsoleOutput
			see https://central.sonatype.org/publish/publish-maven/ -->
			<id>releaseToMaven</id>
			<build>
				<plugins>
					<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>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-source-plugin</artifactId>
						<version>${maven-source-plugin.version}</version>
						<executions>
							<execution>
								<id>attach-sources</id>
								<goals>
									<goal>jar-no-fork</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-javadoc-plugin</artifactId>
						<version>${maven-javadoc-plugin.version}</version>
						<executions>
							<execution>
								<id>attach-javadocs</id>
								<goals>
									<goal>jar</goal>
								</goals>
								<configuration>
									<doclint>${javadoc.doclint}</doclint>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>

	<distributionManagement>
		<snapshotRepository>
			<id>central</id>
			<url>https://central.sonatype.com/repository/maven-snapshots/</url>
		</snapshotRepository>
	</distributionManagement>

</project>
