<?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"
         child.project.url.inherit.append.path="false">
    <modelVersion>4.0.0</modelVersion>

    <groupId>be.wegenenverkeer</groupId>
    <artifactId>atomium-client</artifactId>
    <version>4.0.0-RC2</version>
    <packaging>pom</packaging>
    <name>${project.groupId}:${project.artifactId}</name>
    <description>Java libraries for consuming an Atomium feed from an application.</description>
    <url>https://github.com/WegenenVerkeer/atomium-client</url>

    <!--
      Parent + aggregator for the atomium-client libraries.

      Versioning policy (see VERSIONING.md): all modules share a single suite version (semver on the public API
      of the suite), independent of the versions of external dependencies. The versions of Jackson (3) and
      Spring (min 6.1) are pinned here as an explicit baseline (jackson.version / spring.version).
    -->

    <licenses>
        <license>
            <name>MIT License</name>
            <url>https://opensource.org/license/mit</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <organization>Agentschap Wegen en Verkeer (AWV)</organization>
            <organizationUrl>https://wegenenverkeer.be</organizationUrl>
        </developer>
    </developers>

    <scm child.scm.connection.inherit.append.path="false"
         child.scm.developerConnection.inherit.append.path="false"
         child.scm.url.inherit.append.path="false">
        <connection>scm:git:https://github.com/WegenenVerkeer/atomium-client.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/WegenenVerkeer/atomium-client.git</developerConnection>
        <url>https://github.com/WegenenVerkeer/atomium-client</url>
    </scm>

    <modules>
        <module>atomium-client-bom</module>
        <module>atomium-client-core</module>
        <module>atomium-client-jackson-3</module>
        <module>atomium-client-restclient</module>
        <!-- standalone demo app (local only); shows standalone use of the core lib: -->
        <module>atomium-client-core-demo</module>
        <module>atomium-client-spring-boot-4</module>
        <!-- standalone demo app (local only); shows standalone use of the spring-boot-4 lib: -->
        <module>atomium-client-spring-boot-4-demo</module>
    </modules>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>21</java.version>
        <maven.compiler.release>21</maven.compiler.release>

        <!-- baseline versions of the external libraries the suite supports -->
        <jspecify.version>1.0.0</jspecify.version>
        <slf4j.version>2.0.17</slf4j.version>
        <jackson.version>3.1.4</jackson.version>       <!-- Jackson 3 (tools.jackson); baseline for atomium-client-jackson-3 -->
        <spring.version>6.1.14</spring.version>         <!-- Spring Framework; minimum baseline (6.1) for atomium-client-restclient -->
        <junit.version>6.0.3</junit.version>
        <assertj.version>3.27.7</assertj.version>
        <!-- slf4j binding for core tests that assert framework log output (deliberately NOT in
             dependencyManagement: the Boot modules must keep Boot's own managed logback version) -->
        <logback.version>1.5.18</logback.version>

        <!-- Spring Boot version for the atomium-client-spring-boot-4 modules -->
        <spring-boot.version>4.0.7</spring-boot.version>
        <!-- wiremock (plain JUnit 5 extension) for the integration tests -->
        <wiremock.version>3.13.2</wiremock.version>
        <!-- wiremock-spring-boot (@EnableWireMock) for the spring-boot integration tests -->
        <wiremock-spring-boot.version>4.0.9</wiremock-spring-boot.version>

        <maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
        <maven-surefire-plugin.version>3.5.2</maven-surefire-plugin.version>
        <maven-failsafe-plugin.version>3.5.2</maven-failsafe-plugin.version>
        <maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>
        <maven-source-plugin.version>3.3.1</maven-source-plugin.version>
        <maven-javadoc-plugin.version>3.11.2</maven-javadoc-plugin.version>
        <maven-gpg-plugin.version>3.2.8</maven-gpg-plugin.version>
        <central-publishing-maven-plugin.version>0.11.0</central-publishing-maven-plugin.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- suite-wide version alignment for the non-Boot modules -->
            <!-- (the atomium-client-spring-boot-4 modules manage their Boot-bound versions themselves) -->
            <dependency>
                <groupId>org.jspecify</groupId>
                <artifactId>jspecify</artifactId>
                <version>${jspecify.version}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>tools.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${jackson.version}</version>
            </dependency>
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter</artifactId>
                <version>${junit.version}</version>
            </dependency>
            <dependency>
                <groupId>org.assertj</groupId>
                <artifactId>assertj-core</artifactId>
                <version>${assertj.version}</version>
            </dependency>
            <dependency>
                <groupId>org.wiremock</groupId>
                <artifactId>wiremock-standalone</artifactId>
                <version>${wiremock.version}</version>
            </dependency>
            <dependency>
                <groupId>org.wiremock.integrations</groupId>
                <artifactId>wiremock-spring-boot</artifactId>
                <version>${wiremock-spring-boot.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven-compiler-plugin.version}</version>
                </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-surefire-plugin</artifactId>
                    <version>${maven-surefire-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${maven-failsafe-plugin.version}</version>
                </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>
                    <configuration>
                        <quiet>true</quiet>
                        <doclint>none</doclint>
                        <failOnError>false</failOnError>
                    </configuration>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <!-- integration tests (*IT) run in the verify phase; unit tests (*Test) in the test phase -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>central</id>
            <build>
                <plugins>
                    <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>
                            <autoPublish>true</autoPublish>
                            <!-- wait for validation (that is the signal that can fail), not for the publish
                                 itself: publishing continues automatically server-side and can exceed the
                                 30-minute polling window, which would fail the build after the point of no return -->
                            <waitUntil>validated</waitUntil>
                            <excludeArtifacts>
                                <excludeArtifact>atomium-client-core-demo</excludeArtifact>
                                <excludeArtifact>atomium-client-spring-boot-4-demo</excludeArtifact>
                            </excludeArtifacts>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>release</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>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
