<?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>org.beilstein</groupId>
	<artifactId>bchemxtract</artifactId>
	<packaging>jar</packaging>
	<name>BChemXtract</name>
	<version>1.2.0</version>
	<url>https://github.com/Beilstein-Institut/BChemXtract</url>
	<description>A pure-Java extractor of ChemDraw structures.</description>

	<licenses>
		<license>
			<name>MIT License</name>
			<url>https://mit-license.org/</url>
		</license>
	</licenses>

	<developers>
		<developer>
			<name>Felix Bänsch</name>
			<email>open-source@beilstein-institut.de</email>
			<organization>Beilstein Institut</organization>
			<organizationUrl>https://github.com/Beilstein-Institut</organizationUrl>
		</developer>
		<developer>
			<name>Markus Nietfeld</name>
			<email>open-source@beilstein-institut.de</email>
			<organization>Beilstein Institut</organization>
			<organizationUrl>https://github.com/Beilstein-Institut</organizationUrl>
		</developer>
		<developer>
			<name>Udo Reschel</name>
			<email>open-source@beilstein-institut.de</email>
			<organization>Beilstein Institut</organization>
			<organizationUrl>https://github.com/Beilstein-Institut</organizationUrl>
		</developer>
	</developers>

	<scm>
		<connection>scm:git:git://github.com/Beilstein-Institut/BChemXtract</connection>
		<developerConnection>
			scm:git:ssh://github.com/Beilstein-Institut/BChemXtract</developerConnection>
		<url>https://github.com/Beilstein-Institut/BChemXtract</url>
	</scm>


	<properties>
		<cdk.version>2.12</cdk.version>
		<maven.compiler.source>17</maven.compiler.source>
		<maven.compiler.target>17</maven.compiler.target>
		<java.version>17</java.version>
		<source.encoding>UTF-8</source.encoding>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	</properties>


	<build>

		<resources>
			<resource>
				<directory>src/main/java</directory>
				<excludes>
					<exclude>**/*.java</exclude>
					<exclude>**/package.html</exclude>
				</excludes>
			</resource>
			<resource>
				<directory>src/main/resources</directory>
			</resource>
		</resources>

		<testResources>
			<testResource>
				<directory>src/test/java</directory>
				<excludes>
					<exclude>**/*.java</exclude>
					<exclude>**/package.html</exclude>
				</excludes>
			</testResource>
			<testResource>
				<directory>src/test/resources</directory>
			</testResource>
		</testResources>

		<plugins>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-source-plugin</artifactId>
				<version>3.4.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-javadoc-plugin</artifactId>
				<version>3.12.0</version>
				<executions>
					<execution>
						<id>attach-javadocs</id>
						<goals>
							<goal>jar</goal>
						</goals>
					</execution>
				</executions>
			</plugin>


			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.15.0</version>
				<configuration>
					<release>${java.version}</release>
					<encoding>${source.encoding}</encoding>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-resources-plugin</artifactId>
				<version>3.5.0</version>
				<configuration>
					<encoding>${source.encoding}</encoding>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<version>3.5.6</version>
				<dependencies>
					<!-- P-9 fix: pin the full junit-platform triplet (launcher + engine +
					     commons) to the JUnit-6-aligned (6.0.3) version, overriding
					     Surefire 3.5.5's transitive 1.12.x bundle pulled via
					     surefire-junit-platform; see apache/maven-surefire#3216.
					     Pinning launcher alone is insufficient because Surefire's fork
					     classpath construction loaded both 6.0.3 and 1.12.2 jars,
					     producing OutputDirectoryCreator-not-available at discovery.
					     Maven plugin <dependencies> do NOT honor the project's
					     <dependencyManagement> (BOM imports), so versions are explicit
					     literals here — keep them in lock-step with the junit-bom version
					     above. -->
					<dependency>
						<groupId>org.junit.platform</groupId>
						<artifactId>junit-platform-launcher</artifactId>
						<version>6.1.2</version>
					</dependency>
					<dependency>
						<groupId>org.junit.platform</groupId>
						<artifactId>junit-platform-engine</artifactId>
						<version>6.1.2</version>
					</dependency>
					<dependency>
						<groupId>org.junit.platform</groupId>
						<artifactId>junit-platform-commons</artifactId>
						<version>6.1.2</version>
					</dependency>
					<!-- Run Jupiter tests via the JUnit Platform provider -->
					<dependency>
						<groupId>org.apache.maven.surefire</groupId>
						<artifactId>surefire-junit-platform</artifactId>
						<version>3.5.6</version>
					</dependency>
				</dependencies>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-site-plugin</artifactId>
				<version>3.22.0</version>
				<configuration>
					<siteDirectory>doc</siteDirectory>
					<inputEncoding>${source.encoding}</inputEncoding>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-assembly-plugin</artifactId>
				<version>3.8.0</version>
				<configuration>
					<archive>
						<manifest>
							<mainClass>
								org.beilstein.chemxtract.samples.BCXTractSubstances</mainClass>
						</manifest>
					</archive>
					<descriptorRefs>
						<descriptorRef>jar-with-dependencies</descriptorRef>
					</descriptorRefs>
				</configuration>
				<executions>
					<execution>
						<id>make-assembly</id>
						<!-- bind to the packaging phase -->
						<phase>package</phase>
						<goals>
							<goal>single</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>com.diffplug.spotless</groupId>
				<artifactId>spotless-maven-plugin</artifactId>
				<version>3.8.0</version>
				<configuration>
					<java>
						<googleJavaFormat/>
						<licenseHeader>
							<file>${project.basedir}/doc/license-header/License-header.txt</file>
						</licenseHeader>
						<removeUnusedImports/>
						<trimTrailingWhitespace/>
						<endWithNewline/>
						<formatAnnotations/>
						<encoding>UTF-8</encoding>
					</java>
				</configuration>
				<executions>
					<execution>
						<goals>
							<goal>check</goal>
						</goals>
						<phase>package</phase>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.jacoco</groupId>
				<artifactId>jacoco-maven-plugin</artifactId>
				<version>0.8.15</version>
				<executions>
					<execution>
						<id>prepare-agent</id>
						<goals>
							<goal>prepare-agent</goal>
						</goals>
					</execution>
					<execution>
						<id>report</id>
						<phase>verify</phase>
						<goals>
							<goal>report</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>

	</build>

	<profiles>
		<!--
			Quality profile: runs Checkstyle, PMD and SpotBugs. Activate with
			`mvn -Pquality verify`. All gates FAIL the build on violations. Kept
			off the default lifecycle so day-to-day developer builds stay fast.
			Dependency CVE scanning is handled in CI by Trivy (security.yml).
		-->
		<profile>
			<id>quality</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-checkstyle-plugin</artifactId>
						<version>3.6.0</version>
						<dependencies>
							<dependency>
								<groupId>com.puppycrawl.tools</groupId>
								<artifactId>checkstyle</artifactId>
								<version>13.8.0</version>
							</dependency>
						</dependencies>
						<configuration>
							<configLocation>${project.basedir}/checkstyle.xml</configLocation>
							<suppressionsLocation>${project.basedir}/checkstyle-suppressions.xml</suppressionsLocation>
							<consoleOutput>true</consoleOutput>
							<failsOnError>true</failsOnError>
							<failOnViolation>true</failOnViolation>
							<!-- checkstyle.xml sets severity=warning globally; without this
							     the check goal only counts 'error' and never fails. -->
							<violationSeverity>warning</violationSeverity>
							<includeTestSourceDirectory>false</includeTestSourceDirectory>
						</configuration>
						<executions>
							<execution>
								<id>checkstyle-check</id>
								<phase>verify</phase>
								<goals>
									<goal>check</goal>
								</goals>
							</execution>
						</executions>
					</plugin>

					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-pmd-plugin</artifactId>
						<version>3.28.0</version>
						<configuration>
							<targetJdk>${java.version}</targetJdk>
							<failOnViolation>true</failOnViolation>
							<printFailingErrors>true</printFailingErrors>
							<includeTests>false</includeTests>
						</configuration>
						<executions>
							<execution>
								<id>pmd-check</id>
								<phase>verify</phase>
								<goals>
									<goal>check</goal>
								</goals>
							</execution>
						</executions>
					</plugin>

					<plugin>
						<groupId>com.github.spotbugs</groupId>
						<artifactId>spotbugs-maven-plugin</artifactId>
						<version>4.10.3.0</version>
						<configuration>
							<effort>Max</effort>
							<threshold>Default</threshold>
							<failOnError>true</failOnError>
							<excludeFilterFile>${project.basedir}/spotbugs-exclude.xml</excludeFilterFile>
							<includeTests>false</includeTests>
						</configuration>
						<executions>
							<execution>
								<id>spotbugs-check</id>
								<phase>verify</phase>
								<goals>
									<goal>check</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>

		<!--
			Release profile: signs artifacts with GPG and publishes to Maven Central
			via the new Central Portal (central.sonatype.com).

			Required environment / GitHub Actions secrets:
			  MAVEN_GPG_PRIVATE_KEY  - ASCII-armored private key
			  MAVEN_GPG_PASSPHRASE   - passphrase
			  CENTRAL_USERNAME       - Central Portal user-token name
			  CENTRAL_PASSWORD       - Central Portal user-token value

			Activate with `mvn -Prelease deploy`.
		-->
		<profile>
			<id>release</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-gpg-plugin</artifactId>
						<version>3.2.8</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>

					<plugin>
						<groupId>org.sonatype.central</groupId>
						<artifactId>central-publishing-maven-plugin</artifactId>
						<version>0.11.0</version>
						<extensions>true</extensions>
						<configuration>
							<publishingServerId>central</publishingServerId>
							<autoPublish>true</autoPublish>
							<waitUntil>published</waitUntil>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>


	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.junit</groupId>
				<artifactId>junit-bom</artifactId>
				<version>6.1.2</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
		</dependencies>
	</dependencyManagement>


	<dependencies>

		<dependency>
			<groupId>org.openscience.cdk</groupId>
			<artifactId>cdk-extra</artifactId>
			<version>${cdk.version}</version>
			<exclusions>
				<exclusion>
					<groupId>xml-apis</groupId>
					<artifactId>xml-apis</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<dependency>
			<groupId>org.openscience.cdk</groupId>
			<artifactId>cdk-depict</artifactId>
			<version>${cdk.version}</version>
			<exclusions>
				<exclusion>
					<groupId>xml-apis</groupId>
					<artifactId>xml-apis</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<dependency>
			<groupId>org.openscience.cdk</groupId>
			<artifactId>cdk-inchi</artifactId>
			<version>${cdk.version}</version>
			<exclusions>
				<exclusion>
					<groupId>xml-apis</groupId>
					<artifactId>xml-apis</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<dependency>
			<groupId>org.openscience.cdk</groupId>
			<artifactId>cdk-jniinchi-support</artifactId>
			<version>${cdk.version}</version>
			<exclusions>
				<exclusion>
					<groupId>xml-apis</groupId>
					<artifactId>xml-apis</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<dependency>
			<groupId>org.openscience.cdk</groupId>
			<artifactId>cdk-rinchi</artifactId>
			<version>${cdk.version}</version>
			<exclusions>
				<exclusion>
					<groupId>xml-apis</groupId>
					<artifactId>xml-apis</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<dependency>
			<groupId>org.openscience.cdk</groupId>
			<artifactId>cdk-fingerprint</artifactId>
			<version>${cdk.version}</version>
			<exclusions>
				<exclusion>
					<groupId>xml-apis</groupId>
					<artifactId>xml-apis</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<!--    <dependency>-->
		<!--      <groupId>org.openscience.cdk</groupId>-->
		<!--      <artifactId>cdk-bundle</artifactId>-->
		<!--      <version>${cdk.version}</version>-->
		<!--      <exclusions>-->
		<!--        <exclusion>-->
		<!--          <groupId>xml-apis</groupId>-->
		<!--          <artifactId>xml-apis</artifactId>-->
		<!--        </exclusion>-->
		<!--      </exclusions>-->
		<!--    </dependency>-->

		<!-- ================= Tests =========================== -->
		<!-- JUnit 6 (Jupiter) — version managed by junit-bom -->
		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.mockito</groupId>
			<artifactId>mockito-core</artifactId>
			<version>5.23.0</version>
			<scope>test</scope>
		</dependency>

		<!-- Mockito Jupiter integration — provides MockitoExtension -->
		<dependency>
			<groupId>org.mockito</groupId>
			<artifactId>mockito-junit-jupiter</artifactId>
			<version>5.23.0</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.assertj</groupId>
			<artifactId>assertj-core</artifactId>
			<version>3.27.7</version>
			<scope>test</scope>
		</dependency>

		<!-- SLF4J is the logging facade. This is the ONLY logging artifact
		     consumers of this library inherit; they choose their own backend. -->
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>2.0.18</version>
		</dependency>

		<!-- Log4j2 backend for this project's own tests and the runnable
		     demo (fat) JAR. Marked optional so it is NOT forced onto library
		     consumers; optional deps stay on our own runtime/test classpath
		     and are still bundled by the assembly plugin. -->
		<dependency>
			<groupId>org.apache.logging.log4j</groupId>
			<artifactId>log4j-core</artifactId>
			<version>2.26.1</version>
			<scope>runtime</scope>
			<optional>true</optional>
		</dependency>

		<!-- Log4j 2 provider for the SLF4J 2.x API (ServiceLoader-based). -->
		<dependency>
			<groupId>org.apache.logging.log4j</groupId>
			<artifactId>log4j-slf4j2-impl</artifactId>
			<version>2.26.1</version>
			<scope>runtime</scope>
			<optional>true</optional>
		</dependency>


	</dependencies>


</project>
