<?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>life.qbic</groupId>
  <artifactId>compass</artifactId>
  <version>1.0.0-alpha.3</version>

  <name>${project.groupId}:${project.artifactId}</name>
  <description>Java library for FAIR Signposting validation of RFC 8288 Web Links.</description>
  <url>https://github.com/qbicsoftware/compass</url>

  <properties>
    <maven.compiler.source>21</maven.compiler.source>
    <maven.compiler.target>21</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <linksmith.version>1.0.0-alpha.3</linksmith.version>
    <jackson.version>3.0.3</jackson.version>
    <groovy.version>5.0.0-alpha-12</groovy.version>
    <spock.version>2.4-M7-groovy-5.0</spock.version>
    <gmavenplus.version>4.2.1</gmavenplus.version>
  </properties>

  <licenses>
    <license>
      <name>GNU Affero General Public License, Version 3.0</name>
      <url>https://www.gnu.org/licenses/agpl-3.0.html.en#license-text</url>
    </license>
  </licenses>

  <developers>
    <developer>
      <name>Sven Fillinger</name>
      <email>sven.fillinger@uni-tuebingen.de</email>
      <organization>University of Tübingen</organization>
      <organizationUrl>https://uni-tuebingen.de</organizationUrl>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:git://github.com/qbicsoftware/compass.git</connection>
    <developerConnection>scm:git:ssh://github.com:qbicsoftware/compass.git</developerConnection>
    <url>http://github.com/qbicsoftware/compass/tree/main</url>
  </scm>

  <dependencies>
    <dependency>
      <groupId>life.qbic</groupId>
      <artifactId>linksmith</artifactId>
      <version>${linksmith.version}</version>
    </dependency>
    <dependency>
      <groupId>tools.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>${jackson.version}</version>
    </dependency>
    <dependency>
      <groupId>org.spockframework</groupId>
      <artifactId>spock-core</artifactId>
      <version>${spock.version}</version>
      <scope>test</scope>
    </dependency>
    <!-- Groovy runtime for the specs -->
    <dependency>
      <groupId>org.apache.groovy</groupId>
      <artifactId>groovy</artifactId>
      <version>${groovy.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>license-maven-plugin</artifactId>
        <version>2.7.0</version> <!-- Use the latest version -->
        <executions>
          <execution>
            <goals>
              <goal>aggregate-add-third-party</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <!-- Configuration for licenses aggregation -->
          <outputDirectory>${project.build.directory}/generated-sources/license</outputDirectory>
          <thirdPartyFilename>THIRD-PARTY.txt</thirdPartyFilename>
          <failIfWarning>false</failIfWarning> <!-- Optional: fail the build on issues -->
          <includeTransitiveDependencies>true</includeTransitiveDependencies>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.gmavenplus</groupId>
        <artifactId>gmavenplus-plugin</artifactId>
        <version>${gmavenplus.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>addSources</goal>
              <goal>addTestSources</goal>
              <goal>generateStubs</goal>
              <goal>compile</goal>
              <goal>generateTestStubs</goal>
              <goal>compileTests</goal>
              <goal>removeStubs</goal>
              <goal>removeTestStubs</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <groovyDocOutputDirectory>${project.build.directory}/site/gapidocs
          </groovyDocOutputDirectory>
          <testGroovyDocOutputDirectory>${project.build.directory}/site/testgapidocs
          </testGroovyDocOutputDirectory>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.5.2</version>
        <configuration>
          <useModulePath>false</useModulePath>
          <includes>
            <include>**/*Spec.class</include>
          </includes>
        </configuration>
      </plugin>
      <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>
          </execution>
        </executions>
        <configuration>
          <gpgArguments>
            <arg>--pinentry-mode</arg>
            <arg>loopback</arg>
          </gpgArguments>

          <!-- We pass this in via a property (local or CI) -->
          <passphrase>${gpg.passphrase}</passphrase>
        </configuration>
      </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-javadoc-plugin</artifactId>
        <version>3.8.0</version>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>release</id>
      <properties>
        <!-- this is what the plugin reads -->
        <gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
      </properties>
    </profile>
    <profile>
      <id>sigcheck</id>
      <activation>
        <file>
          <exists>src/main</exists>
        </file>
      </activation>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-site-plugin</artifactId>
              <version>4.0.0-M16</version>
            </plugin>
            <plugin>
              <groupId>org.simplify4u.plugins</groupId>
              <artifactId>pgpverify-maven-plugin</artifactId>
              <version>1.19.1</version>
              <dependencies>
                <dependency>
                  <groupId>org.simplify4u</groupId>
                  <artifactId>pgp-keys-map</artifactId>
                  <version>2025.03.15</version> <!-- use latest available -->
                </dependency>
              </dependencies>
            </plugin>
          </plugins>
        </pluginManagement>
        <plugins>
          <plugin>
            <groupId>org.simplify4u.plugins</groupId>
            <artifactId>pgpverify-maven-plugin</artifactId>
            <executions>
              <!-- bind early so you fail fast -->
              <execution>
                <id>pgp-verify</id>
                <goals>
                  <goal>check</goal>
                </goals>
                <phase>validate</phase>
              </execution>
            </executions>
            <configuration>
              <!-- verify build plugins too (compiler, surefire, etc.) -->
              <verifyPlugins>true</verifyPlugins>
              <verifyPluginDependencies>false</verifyPluginDependencies>
              <!-- include provided deps if you want to check servlet APIs etc. -->
              <verifyProvidedDependencies>false</verifyProvidedDependencies>
              <!-- optionally check SNAPSHOTs as well -->
              <verifySnapshots>false</verifySnapshots>
              <!-- add a keys map to lock critical coords to expected fingerprints -->
              <keysMapLocations>
                <!-- our overrides / allow-list -->
                <keysMapLocation>/pgp-keys-map.list</keysMapLocation>
                <keysMapLocation>${maven.multiModuleProjectDirectory}/pgp-keys-override.list</keysMapLocation>
              </keysMapLocations>
              <suppressSignatureOkLogging>true</suppressSignatureOkLogging>
              <!-- write a JSON report (optional) -->
              <reportWrite>true</reportWrite>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.cyclonedx</groupId>
            <artifactId>cyclonedx-maven-plugin</artifactId>
            <version>2.8.0</version>
            <executions>
              <!-- Top-level aggregate SBOM covering all modules -->
              <execution>
                <id>aggregate-bom</id>
                <phase>package</phase>
                <goals>
                  <goal>makeAggregateBom</goal>
                </goals>
                <configuration>
                  <schemaVersion>1.5</schemaVersion>
                  <outputFormat>json</outputFormat>   <!-- produces .json -->
                  <outputName>${project.artifactId}-${project.version}-sbom</outputName>
                  <includeBomSerialNumber>true</includeBomSerialNumber>
                  <includeLicenseText>true</includeLicenseText>
                </configuration>
              </execution>

              <!-- (Optional) Per-module SBOMs; keep if you also want one per JAR -->
              <execution>
                <id>module-bom</id>
                <phase>package</phase>
                <goals>
                  <goal>makeAggregateBom</goal>
                </goals>
                <configuration>
                  <schemaVersion>1.5</schemaVersion>
                  <outputFormat>json</outputFormat>
                  <includeBomSerialNumber>true</includeBomSerialNumber>
                  <includeLicenseText>true</includeLicenseText>
                </configuration>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.8.12</version>
            <executions>
              <!-- Attach JaCoCo agent to tests -->
              <execution>
                <id>prepare-agent</id>
                <goals>
                  <goal>prepare-agent</goal>
                </goals>
              </execution>
              <!-- Generate coverage report after tests -->
              <execution>
                <id>report</id>
                <phase>test</phase>
                <goals>
                  <goal>report</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.sonatype.central</groupId>
            <artifactId>central-publishing-maven-plugin</artifactId>
            <version>0.9.0</version>
            <extensions>true</extensions>
            <configuration>
              <publishingServerId>central</publishingServerId>
              <checksums>required</checksums>
              <autoPublish>true</autoPublish>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
