<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.itsallcode</groupId>
    <artifactId>openfasttrace-maven-plugin</artifactId>
    <version>3.0.0</version>
    <packaging>maven-plugin</packaging>

    <name>OpenFastTrace Maven Plugin</name>
    <description>Maven plugin for requirement tracking</description>

    <url>https://github.com/itsallcode/openfasttrace-maven-plugin</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>17</java.version>
        <oft.version>4.9.0</oft.version>
        <!-- Maven version available in Debian 13 -->
        <maven.core.version>3.9.9</maven.core.version>
        <!-- Below is not a typo. It's the version of the "Maven Plugin-Plugin". -->
        <maven.plugin.plugin.version>3.15.2</maven.plugin.plugin.version>
        <jacoco.version>0.8.15</jacoco.version>
        <sonar.organization>itsallcode</sonar.organization>
        <sonar.host.url>https://sonarcloud.io</sonar.host.url>
        <project.build.outputTimestamp>${git.commit.time}</project.build.outputTimestamp>
        <ossindexSkip>false</ossindexSkip>
    </properties>

    <licenses>
        <license>
            <name>GNU General Public License v3.0</name>
            <url>https://www.gnu.org/licenses/gpl-3.0.html</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>redcatbear</id>
            <url>https://github.com/redcatbear</url>
            <organization>itsallcode</organization>
            <organizationUrl>https://github.com/itsallcode</organizationUrl>
        </developer>

        <developer>
            <id>kaklakariada</id>
            <url>https://github.com/kaklakariada</url>
            <organization>itsallcode</organization>
            <organizationUrl>https://github.com/itsallcode</organizationUrl>
            <email>github@chp1.net</email>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:https://github.com/itsallcode/openfasttrace-maven-plugin.git</connection>
        <developerConnection>scm:git:https://github.com/itsallcode/openfasttrace-maven-plugin.git</developerConnection>
        <url>https://github.com/itsallcode/openfasttrace-maven-plugin</url>
    </scm>

    <prerequisites>
        <maven>${maven.core.version}</maven>
    </prerequisites>

    <dependencies>
        <dependency>
            <groupId>org.itsallcode.openfasttrace</groupId>
            <artifactId>openfasttrace-api</artifactId>
            <version>${oft.version}</version>
        </dependency>
        <dependency>
            <groupId>org.itsallcode.openfasttrace</groupId>
            <artifactId>openfasttrace</artifactId>
            <version>${oft.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-utils</artifactId>
            <!-- Build fails with version > 4.0.0 -->
            <!-- Fix CVE-2025-67030 -->
            <version>4.0.3</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>${maven.core.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-annotations</artifactId>
            <version>${maven.plugin.plugin.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
            <version>${maven.core.version}</version>
            <scope>provided</scope>
        </dependency>
        <!-- Test dependencies -->
        <dependency>
            <groupId>org.apache.maven.plugin-testing</groupId>
            <artifactId>maven-plugin-testing-harness</artifactId>
            <version>3.5.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-library</artifactId>
            <version>3.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-compat</artifactId>
            <version>${maven.core.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.exasol</groupId>
            <artifactId>maven-project-version-getter</artifactId>
            <version>1.2.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.exasol</groupId>
            <artifactId>maven-plugin-integration-testing</artifactId>
            <version>1.1.5</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>6.1.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <version>5.23.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.itsallcode</groupId>
            <artifactId>hamcrest-auto-matcher</artifactId>
            <version>0.8.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jacoco</groupId>
            <artifactId>org.jacoco.agent</artifactId>
            <version>${jacoco.version}</version>
            <classifier>runtime</classifier>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>central-publishing</id>
            <properties>
                <centralPublishingSkipPublishing>false</centralPublishingSkipPublishing>
                <centralPublishingAutoPublish>false</centralPublishingAutoPublish>
                <centralPublishingDeploymentName>Manual deployment of OFT Maven Plugin</centralPublishingDeploymentName>
            </properties>
            <build>
                <plugins>
                    <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>validated</waitUntil>
                        </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>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-deploy-plugin</artifactId>
                        <version>3.1.4</version>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <build>
        <plugins>
            <plugin>
                <groupId>io.github.git-commit-id</groupId>
                <artifactId>git-commit-id-maven-plugin</artifactId>
                <version>10.0.0</version>
                <executions>
                    <execution>
                        <id>get-the-git-infos</id>
                        <goals>
                            <goal>revision</goal>
                        </goals>
                        <phase>initialize</phase>
                    </execution>
                </executions>
                <configuration>
                    <verbose>true</verbose>
                    <skipPoms>false</skipPoms>
                    <includeOnlyProperties>
                        <includeOnlyProperty>git.commit.time</includeOnlyProperty>
                    </includeOnlyProperties>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-toolchains-plugin</artifactId>
                <version>3.3.0</version>
                <executions>
                    <execution>
                        <?m2e ignore?>
                        <goals>
                            <goal>toolchain</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <toolchains>
                        <jdk>
                            <version>${java.version}</version>
                        </jdk>
                    </toolchains>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>3.6.3</version>
                <executions>
                    <execution>
                        <id>enforce-maven</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>${maven.core.version}</version>
                                </requireMavenVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <version>3.5.0</version>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>src/test/resources</directory>
                            <includes>
                                <include>*/target/**</include>
                            </includes>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.15.0</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-plugin-plugin</artifactId>
                            <version>${maven.plugin.plugin.version}</version>
                        </path>
                    </annotationProcessorPaths>
                    <compilerArgs>
                        <!-- Ignore warnings about annotations -->
                        <arg>-Xlint:all</arg>
                        <arg>-Werror</arg>
                    </compilerArgs>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <version>${maven.plugin.plugin.version}</version>
                <configuration>
                    <goalPrefix>openfasttrace</goalPrefix>
                    <skipErrorNoDescriptorsFound>false</skipErrorNoDescriptorsFound>
                    <requiredJavaVersion>${java.version}</requiredJavaVersion>
                </configuration>
                <executions>
                    <execution>
                        <id>mojo-descriptor</id>
                        <goals>
                            <goal>descriptor</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>help-goal</id>
                        <goals>
                            <goal>helpmojo</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <!-- Upgrade to a version that supports reproducible builds -->
                <version>3.5.1</version>
            </plugin>
            <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>
                <configuration>
                    <charset>UTF-8</charset>
                    <doclint/>
                    <serialwarn>true</serialwarn>
                    <failOnError>true</failOnError>
                    <!-- Generated class HelpMojo causes warning with Java 21: use of default constructor, which does not provide a comment -->
                    <failOnWarnings>false</failOnWarnings>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.version}</version>
                <executions>
                    <execution>
                        <id>prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>prepare-agent-integration</id>
                        <goals>
                            <goal>prepare-agent-integration</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>merge-results</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>merge</goal>
                        </goals>
                        <configuration>
                            <fileSets>
                                <fileSet>
                                    <directory>${project.build.directory}/</directory>
                                    <includes>
                                        <include>jacoco*.exec</include>
                                    </includes>
                                </fileSet>
                            </fileSets>
                            <destFile>${project.build.directory}/aggregate.exec</destFile>
                        </configuration>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <dataFile>${project.build.directory}/aggregate.exec</dataFile>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.11.0</version>
                <executions>
                    <execution>
                        <id>copy-jacoco</id>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <phase>compile</phase>
                        <configuration>
                            <includeArtifactIds>org.jacoco.agent</includeArtifactIds>
                            <includeClassifiers>runtime</includeClassifiers>
                            <outputDirectory>${project.build.directory}/jacoco-agent</outputDirectory>
                            <stripVersion>true</stripVersion>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.5.6</version>
                <configuration>
                    <systemPropertyVariables>
                        <java.util.logging.config.file>src/test/resources/logging.properties</java.util.logging.config.file>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>3.5.6</version>
                <configuration>
                    <systemPropertyVariables>
                        <test.coverage>true</test.coverage>
                        <java.util.logging.config.file>src/test/resources/logging.properties</java.util.logging.config.file>
                    </systemPropertyVariables>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>versions-maven-plugin</artifactId>
                <version>2.21.0</version>
                <configuration>
                    <excludes>
                        <!-- Pin Maven version to 3.x -->
                        <exclude>org.apache.maven:maven-plugin-api:jar:*:*</exclude>
                        <exclude>org.apache.maven:maven-core:jar:*:*</exclude>
                        <exclude>org.codehaus.plexus:plexus-utils:jar:*:*</exclude>
                        <exclude>org.apache.maven.plugin-testing:maven-plugin-testing-harness:jar:*:*</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.sonatype.ossindex.maven</groupId>
                <artifactId>ossindex-maven-plugin</artifactId>
                <version>3.2.0</version>
                <executions>
                    <execution>
                        <id>audit</id>
                        <phase>package</phase>
                        <goals>
                            <goal>audit</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <authId>ossindex</authId>
                    <skip>${ossindexSkip}</skip>
                    <excludeVulnerabilityIds>
                        <!-- com.google.guava:guava:jar:25.1-android has scope provided -->
                        <exclude>CVE-2023-2976</exclude>
                        <exclude>CVE-2020-8908</exclude>
                    </excludeVulnerabilityIds>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.basepom.maven</groupId>
                <artifactId>duplicate-finder-maven-plugin</artifactId>
                <version>2.0.1</version>
                <executions>
                    <execution>
                        <id>default</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <printEqualFiles>false</printEqualFiles>
                    <failBuildInCaseOfDifferentContentConflict>true</failBuildInCaseOfDifferentContentConflict>
                    <!-- Workaround for https://github.com/itsallcode/openfasttrace/issues/428 -->
                    <failBuildInCaseOfEqualContentConflict>false</failBuildInCaseOfEqualContentConflict>
                    <failBuildInCaseOfConflict>false</failBuildInCaseOfConflict>
                    <checkCompileClasspath>true</checkCompileClasspath>
                    <checkRuntimeClasspath>true</checkRuntimeClasspath>
                    <checkTestClasspath>false</checkTestClasspath>
                    <preferLocal>true</preferLocal>
                    <useResultFile>false</useResultFile>
                    <ignoredResourcePatterns>
                         <!-- Suppress warning "Found duplicate and different resources in [org.eclipse.sisu:org.eclipse.sisu.inject:0.3.5, org.eclipse.sisu:org.eclipse.sisu.plexus:0.3.5]" -->
                        <ignoredResourcePattern>about.html</ignoredResourcePattern>
                    </ignoredResourcePatterns>
                    <ignoredDependencies>
                        <!-- Workaround for https://github.com/itsallcode/openfasttrace/issues/428: API and openfasttrace module have overlaps -->
                        <ignoredDependency>
                            <groupId>org.itsallcode.openfasttrace</groupId>
                            <artifactId>openfasttrace</artifactId>
                        </ignoredDependency>
                    </ignoredDependencies>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-artifact-plugin</artifactId>
                <version>3.6.1</version>
                <executions>
                    <execution>
                        <id>verify-reproducible-build</id>
                        <phase>verify</phase>
                        <goals><goal>check-buildplan</goal></goals>
                    </execution>
                </executions>
                <configuration>
                    <failOnNonReproducible>true</failOnNonReproducible>
                </configuration>
            </plugin>
            <plugin>
                <!-- Create an aggregated SPDX SBOM -->
                <groupId>org.spdx</groupId>
                <artifactId>spdx-maven-plugin</artifactId>
                <version>1.0.4</version>
                <executions>
                    <execution>
                        <id>aggregate-spdx</id>
                        <goals>
                            <goal>aggregateSPDX</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <sbomType>build</sbomType>
                    <includeCompileScope>true</includeCompileScope>
                    <includeRuntimeScope>true</includeRuntimeScope>
                    <includeProvidedScope>true</includeProvidedScope>
                    <includeSystemScope>false</includeSystemScope>
                    <includeTestScope>false</includeTestScope>
                    <licenseDeclared>GPL-3.0-only</licenseDeclared>
                    <licenseConcluded>GPL-3.0-only</licenseConcluded>
                    <copyrightText>Copyright (c) itsallcode.org</copyrightText>
                    <createExternalRefs>false</createExternalRefs>
                    <defaultFileConcludedLicense>GPL-3.0-only</defaultFileConcludedLicense>
                    <defaultLicenseInformationInFile>GPL-3.0-only</defaultLicenseInformationInFile>
                    <defaultFileCopyright>Copyright (c) itsallcode.org</defaultFileCopyright>
                </configuration>
            </plugin>
            <plugin>
                <!-- Bundle the SPDX SBOM with the Maven artifact -->
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.6.1</version>
                <executions>
                    <execution>
                        <id>attach-spdx-sbom</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>attach-artifact</goal>
                        </goals>
                        <configuration>
                            <artifacts>
                                <artifact>
                                    <file>${project.build.directory}/site/${project.groupId}_${project.artifactId}-${project.version}.spdx.json</file>
                                    <type>spdx</type>
                                    <classifier>sbom</classifier>
                                </artifact>
                            </artifacts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
