<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>io.github.neewrobert</groupId>
    <artifactId>guava-range-parser-parent</artifactId>
    <version>0.3.5</version>
    <packaging>pom</packaging>

    <name>Guava Range Parser</name>
    <description>A library for parsing and formatting Guava Range objects from string notation</description>
    <url>https://github.com/neewrobert/guava-range-parser</url>
    <inceptionYear>2025</inceptionYear>

    <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>

    <developers>
        <developer>
            <id>neewrobert</id>
            <name>Newton dos Santos</name>
        </developer>
    </developers>

    <modules>
        <module>guava-range-parser-benchmarks</module>
        <module>guava-range-parser-bom</module>
        <module>guava-range-parser-core</module>
        <module>guava-range-parser-examples</module>
        <module>guava-range-parser-jackson</module>
        <module>guava-range-parser-spring</module>
    </modules>

    <scm>
        <connection>scm:git:git://github.com/neewrobert/guava-range-parser.git</connection>
        <developerConnection>scm:git:ssh://github.com:neewrobert/guava-range-parser.git</developerConnection>
        <url>https://github.com/neewrobert/guava-range-parser</url>
    </scm>

    <issueManagement>
        <system>GitHub Issues</system>
        <url>https://github.com/neewrobert/guava-range-parser/issues</url>
    </issueManagement>

    <!-- No distributionManagement needed - central-publishing-maven-plugin handles it -->

    <properties>
        <assertj.version>3.27.7</assertj.version>
        <central-publishing-maven-plugin.version>1.2.0</central-publishing-maven-plugin.version>

        <!-- Security scanning -->
        <dependency-check-maven.version>12.2.2</dependency-check-maven.version>
        <error-prone-support.version>0.29.0</error-prone-support.version>

        <!-- Error Prone versions -->
        <error-prone.version>2.49.0</error-prone.version>

        <!-- Code formatting -->
        <fmt-maven-plugin.version>2.29</fmt-maven-plugin.version>

        <!-- Dependency versions -->
        <guava.version>33.6.0-jre</guava.version>
        <jackson.version>2.22.0</jackson.version>

        <!-- Code coverage -->
        <jacoco.version>0.8.15</jacoco.version>

        <!-- Test dependency versions -->
        <jqwik.version>1.10.1</jqwik.version>
        <junit-jupiter.version>6.1.0</junit-jupiter.version>
        <log4j2.version>2.26.0</log4j2.version>

        <!-- Plugin versions -->
        <maven-compiler-plugin.version>3.15.0</maven-compiler-plugin.version>

        <!-- Publishing -->
        <maven-gpg-plugin.version>3.2.8</maven-gpg-plugin.version>
        <maven-jar-plugin.version>3.5.0</maven-jar-plugin.version>
        <maven-javadoc-plugin.version>3.12.0</maven-javadoc-plugin.version>
        <maven-source-plugin.version>3.4.0</maven-source-plugin.version>
        <maven-surefire-plugin.version>3.5.6</maven-surefire-plugin.version>
        <maven.compiler.release>17</maven.compiler.release>
        <pitest-junit5.version>1.2.3</pitest-junit5.version>

        <!-- Pitest mutation testing -->
        <pitest.version>1.25.3</pitest.version>
        <!-- Build settings -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <!-- POM sorting -->
        <sortpom-maven-plugin.version>4.0.0</sortpom-maven-plugin.version>
        <spring-boot.version>4.0.7</spring-boot.version>
    </properties>

    <dependencyManagement>
        <dependencies>

            <!-- Jackson BOM - manages all Jackson module versions -->
            <dependency>
                <groupId>com.fasterxml.jackson</groupId>
                <artifactId>jackson-bom</artifactId>
                <version>${jackson.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <!-- Log4j BOM - override Spring Boot managed version to fix CVE-2026-34479, CVE-2026-34477 -->
            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-bom</artifactId>
                <version>${log4j2.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <!-- Spring Boot -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring-boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <!-- Guava -->
            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>${guava.version}</version>
            </dependency>
            <!-- Project modules -->
            <dependency>
                <groupId>io.github.neewrobert</groupId>
                <artifactId>guava-range-parser-core</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.github.neewrobert</groupId>
                <artifactId>guava-range-parser-jackson</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>io.github.neewrobert</groupId>
                <artifactId>guava-range-parser-spring</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>net.jqwik</groupId>
                <artifactId>jqwik</artifactId>
                <version>${jqwik.version}</version>
            </dependency>
            <dependency>
                <groupId>org.assertj</groupId>
                <artifactId>assertj-core</artifactId>
                <version>${assertj.version}</version>
            </dependency>

            <!-- Testing -->
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter</artifactId>
                <version>${junit-jupiter.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.github.ekryd.sortpom</groupId>
                    <artifactId>sortpom-maven-plugin</artifactId>
                    <version>${sortpom-maven-plugin.version}</version>
                    <configuration>
                        <predefinedSortOrder>recommended_2008_06</predefinedSortOrder>
                        <sortDependencies>scope,groupId,artifactId</sortDependencies>
                        <sortPlugins>groupId,artifactId</sortPlugins>
                        <sortProperties>true</sortProperties>
                        <sortModules>true</sortModules>
                        <keepBlankLines>true</keepBlankLines>
                        <nrOfIndentSpace>4</nrOfIndentSpace>
                        <expandEmptyElements>false</expandEmptyElements>
                        <createBackupFile>false</createBackupFile>
                        <verifyFail>Stop</verifyFail>
                        <verifyFailOn>Strict</verifyFailOn>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>com.spotify.fmt</groupId>
                    <artifactId>fmt-maven-plugin</artifactId>
                    <version>${fmt-maven-plugin.version}</version>
                    <configuration>
                        <style>google</style>
                        <verbose>false</verbose>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>io.github.mavenplugins</groupId>
                    <artifactId>central-publishing-maven-plugin</artifactId>
                    <version>${central-publishing-maven-plugin.version}</version>
                    <extensions>true</extensions>
                    <configuration>
                        <publishingServerId>central</publishingServerId>
                        <autoPublish>true</autoPublish>
                        <waitUntil>published</waitUntil>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven-compiler-plugin.version}</version>
                    <configuration>
                        <release>${maven.compiler.release}</release>
                        <compilerArgs>
                            <arg>-Xlint:all</arg>
                            <arg>-Werror</arg>
                        </compilerArgs>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>${maven-gpg-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>sign-artifacts</id>
                            <goals>
                                <goal>sign</goal>
                            </goals>
                            <phase>verify</phase>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${maven-jar-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${maven-javadoc-plugin.version}</version>
                    <configuration>
                        <doclint>none</doclint>
                        <quiet>true</quiet>
                    </configuration>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <goals>
                                <goal>jar</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-surefire-plugin</artifactId>
                    <version>${maven-surefire-plugin.version}</version>
                    <configuration>
                        <statelessTestsetInfoReporter implementation="org.apache.maven.plugin.surefire.extensions.junit5.JUnit5StatelessTestsetInfoTreeReporter">
                            <theme>MINIMAL</theme>
                        </statelessTestsetInfoReporter>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>io.github.neewrobert</groupId>
                            <artifactId>junit5-tree-reporter</artifactId>
                            <version>1.0.2</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${jacoco.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.owasp</groupId>
                    <artifactId>dependency-check-maven</artifactId>
                    <version>${dependency-check-maven.version}</version>
                    <configuration>
                        <failBuildOnCVSS>7</failBuildOnCVSS>
                        <!-- Disable OSS Index analyzer (requires separate API key) -->
                        <ossindexAnalyzerEnabled>false</ossindexAnalyzerEnabled>
                        <!-- NVD API settings -->
                        <nvdMaxRetryCount>3</nvdMaxRetryCount>
                        <nvdApiDelay>1000</nvdApiDelay>
                        <failOnError>true</failOnError>
                        <formats>
                            <format>HTML</format>
                            <format>JSON</format>
                        </formats>
                        <outputDirectory>${project.build.directory}/dependency-check</outputDirectory>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.pitest</groupId>
                    <artifactId>pitest-maven</artifactId>
                    <version>${pitest.version}</version>
                    <configuration>
                        <targetClasses>
                            <param>io.github.neewrobert.guavarangeparser.*</param>
                        </targetClasses>
                        <targetTests>
                            <param>io.github.neewrobert.guavarangeparser.*</param>
                        </targetTests>
                        <mutators>
                            <mutator>DEFAULTS</mutator>
                        </mutators>
                        <outputFormats>
                            <outputFormat>HTML</outputFormat>
                            <outputFormat>XML</outputFormat>
                        </outputFormats>
                        <timestampedReports>false</timestampedReports>
                        <verbose>false</verbose>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.pitest</groupId>
                            <artifactId>pitest-junit5-plugin</artifactId>
                            <version>${pitest-junit5.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <!-- Note: Run with MAVEN_OPTS if needed for JDK 17+:
                     export MAVEN_OPTS="-\-add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
                     -\-add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED
                     -\-add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED
                     -\-add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
                     -\-add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED" -->
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>io.github.mavenplugins</groupId>
                <artifactId>central-publishing-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <!-- Profile for local development (skip signing) -->
        <profile>
            <id>dev</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Profile for release (enable signing) -->
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <configuration>
                            <skip>false</skip>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Profile for Error Prone static analysis -->
        <profile>
            <id>errorprone</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <configuration>
                            <fork>true</fork>
                            <showWarnings>true</showWarnings>
                            <failOnWarning>false</failOnWarning>
                            <compilerArgs>
                                <arg>-XDcompilePolicy=simple</arg>
                                <arg>--should-stop=ifError=FLOW</arg>
                                <arg>-XDaddTypeAnnotationsToSymbol=true</arg>
                                <arg>-Xplugin:ErrorProne</arg>
                                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg>
                                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
                                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
                                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg>
                                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
                                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg>
                                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
                                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
                                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
                                <arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
                                <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
                                <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
                            </compilerArgs>
                            <annotationProcessorPaths>
                                <path>
                                    <groupId>com.google.errorprone</groupId>
                                    <artifactId>error_prone_core</artifactId>
                                    <version>${error-prone.version}</version>
                                </path>
                                <path>
                                    <groupId>tech.picnic.error-prone-support</groupId>
                                    <artifactId>error-prone-contrib</artifactId>
                                    <version>${error-prone-support.version}</version>
                                </path>
                            </annotationProcessorPaths>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Profile for Pitest mutation testing -->
        <profile>
            <id>pitest</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.pitest</groupId>
                        <artifactId>pitest-maven</artifactId>
                        <executions>
                            <execution>
                                <id>mutation-testing</id>
                                <goals>
                                    <goal>mutationCoverage</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Profile for JaCoCo code coverage -->
        <profile>
            <id>coverage</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>prepare-agent</id>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>report</id>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                                <phase>test</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Profile for OWASP Dependency-Check security scanning -->
        <profile>
            <id>security</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.owasp</groupId>
                        <artifactId>dependency-check-maven</artifactId>
                        <executions>
                            <execution>
                                <id>dependency-check</id>
                                <goals>
                                    <goal>aggregate</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Profile for verifying POM sort order -->
        <profile>
            <id>sortpom</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.github.ekryd.sortpom</groupId>
                        <artifactId>sortpom-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>verify-pom-sorting</id>
                                <goals>
                                    <goal>verify</goal>
                                </goals>
                                <phase>validate</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
