<?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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>eu.europa.ec.joinup.sat</groupId>
    <artifactId>jdplus-main</artifactId>
    <version>3.6.0</version>
    <packaging>pom</packaging>

    <name>${project.artifactId}</name>
    <description>JDemetra+ v3</description>
    <url>https://github.com/${x.github.user}/${x.github.repo}</url>
    <inceptionYear>2013</inceptionYear>

    <licenses>
        <license>
            <name>European Union Public Licence (EUPL)</name>
            <url>https://joinup.ec.europa.eu/page/eupl-text-11-12</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Philippe Charles</name>
            <email>philippe.charles@nbb.be</email>
            <organization>National Bank of Belgium</organization>
            <organizationUrl>https://www.nbb.be</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/${x.github.user}/${x.github.repo}.git</connection>
        <developerConnection>scm:git:ssh://github.com:${x.github.user}/${x.github.repo}.git</developerConnection>
        <url>http://github.com/${x.github.user}/${x.github.repo}/tree/master</url>
    </scm>

    <properties>
        <!-- Java 17 config -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.build.outputTimestamp>2025-11-20T14:20:58Z</project.build.outputTimestamp>
        <maven.compiler.target>17</maven.compiler.target>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.release>17</maven.compiler.release>

        <!-- GitHub hosting -->
        <x.github.user>jdemetra</x.github.user>
        <x.github.repo>${project.artifactId}</x.github.repo>

        <!-- annotations & processors -->
        <lombok.version>1.18.42</lombok.version>
        <java-service.version>1.9.0</java-service.version>
        <java-design.version>1.8.0</java-design.version>
        <jspecify.version>1.0.0</jspecify.version>

        <!-- test frameworks -->
        <junit.version>6.0.1</junit.version>
        <assertj-core.version>3.27.6</assertj-core.version>

        <!-- dependencies -->
        <jd2.version>2.2.6</jd2.version>
        <protobuf.version>4.33.1</protobuf.version>
        <java-io-util.version>0.0.35</java-io-util.version>
        <java-sql-util.version>1.0.7</java-sql-util.version>
        <spreadsheet4j.version>2.5.10</spreadsheet4j.version>
    </properties>

    <modules>
        <module>jdplus-main-base</module>
        <module>jdplus-main-cli</module>
        <module>jdplus-main-desktop</module>
        <module>jdplus-main-bom</module>
    </modules>

    <dependencies>
        <!-- annotations & processors -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>${lombok.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.github.nbbrd.java-design-util</groupId>
            <artifactId>java-design-processor</artifactId>
            <version>${java-design.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.github.nbbrd.java-service-util</groupId>
            <artifactId>java-service-processor</artifactId>
            <version>${java-service.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.jspecify</groupId>
            <artifactId>jspecify</artifactId>
            <version>${jspecify.version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- test frameworks -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>${assertj-core.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <!-- Enforce reproducible builds -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>3.5.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.14.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>3.1.4</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>3.1.4</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.5.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.3.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>3.21.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>3.5.4</version>
                </plugin>
                <!-- Other plugins -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>3.9.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>3.6.2</version>
                </plugin>
                <plugin>
                    <groupId>org.gaul</groupId>
                    <artifactId>modernizer-maven-plugin</artifactId>
                    <version>3.2.0</version>
                </plugin>
                <plugin>
                    <groupId>de.thetaphi</groupId>
                    <artifactId>forbiddenapis</artifactId>
                    <version>3.10</version>
                </plugin>
                <plugin>
                    <groupId>com.github.nbbrd.heylogs</groupId>
                    <artifactId>heylogs-maven-plugin</artifactId>
                    <version>0.14.1</version>
                </plugin>
                <plugin>
                    <groupId>io.github.ascopes</groupId>
                    <artifactId>protobuf-maven-plugin</artifactId>
                    <version>4.0.2</version>
                </plugin>
                <plugin>
                    <groupId>com.amashchenko.maven.plugin</groupId>
                    <artifactId>gitflow-maven-plugin</artifactId>
                    <version>1.21.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>3.3.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>3.12.0</version>
                </plugin>
                <plugin>
                    <groupId>org.simplify4u.plugins</groupId>
                    <artifactId>sign-maven-plugin</artifactId>
                    <version>1.1.0</version>
                </plugin>
                <plugin>
                    <groupId>org.sonatype.central</groupId>
                    <artifactId>central-publishing-maven-plugin</artifactId>
                    <version>0.9.0</version>
                </plugin>
                <plugin>
                    <groupId>org.jreleaser</groupId>
                    <artifactId>jreleaser-maven-plugin</artifactId>
                    <version>1.21.0</version>
                </plugin>
                <plugin>
                    <groupId>org.jreleaser</groupId>
                    <artifactId>jdks-maven-plugin</artifactId>
                    <version>1.21.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>3.7.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>3.2.0</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <!-- 1 Configure basics -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <!-- 1.1 Enable annotation processors -->
                    <annotationProcessorPaths combine.children="append">
                        <path>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                            <version>${lombok.version}</version>
                        </path>
                        <path>
                            <groupId>com.github.nbbrd.java-service-util</groupId>
                            <artifactId>java-service-processor</artifactId>
                            <version>${java-service.version}</version>
                        </path>
                        <path>
                            <groupId>com.github.nbbrd.java-design-util</groupId>
                            <artifactId>java-design-processor</artifactId>
                            <version>${java-design.version}</version>
                        </path>
                    </annotationProcessorPaths>
                </configuration>
                <executions>
                    <execution>
                        <id>default-testCompile</id>
                        <configuration>
                            <!-- 1.2 Disable module path for unit tests -->
                            <useModulePath>false</useModulePath>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <!-- 1.2 Disable module path for unit tests -->
                    <useModulePath>false</useModulePath>
                </configuration>
            </plugin>
            <plugin>
                <groupId>io.github.ascopes</groupId>
                <artifactId>protobuf-maven-plugin</artifactId>
                <configuration>
                    <!-- 1.4 Configure protoc -->
                    <protocVersion>${protobuf.version}</protocVersion>
                    <!-- 1.5 Embed proto definitions in jars and don't fail on missing sources -->
                    <embedSourcesInClassOutputs>true</embedSourcesInClassOutputs>
                    <failOnMissingSources>false</failOnMissingSources>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.amashchenko.maven.plugin</groupId>
                <artifactId>gitflow-maven-plugin</artifactId>
                <configuration>
                    <!-- 1.6 Configure Git branching model -->
                    <gitFlowConfig>
                        <productionBranch>main</productionBranch>
                        <versionTagPrefix>v</versionTagPrefix>
                    </gitFlowConfig>
                </configuration>
            </plugin>

            <!-- 2 Enforce rules -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>extra-enforcer-rules</artifactId>
                        <version>1.11.0</version>
                    </dependency>
                    <dependency>
                        <groupId>org.kordamp.maven</groupId>
                        <artifactId>pomchecker-enforcer-rules</artifactId>
                        <version>1.14.0</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <!-- 2.1 Built-In Rules -->
                                <banDuplicatePomDependencyVersions/>
                                <dependencyConvergence/>
                                <reactorModuleConvergence/>
                                <requireMavenVersion>
                                    <version>3.6.0</version>
                                </requireMavenVersion>
                                <requireNoRepositories/>
                                <requirePluginVersions/>
                                <requireProperty>
                                    <property>project.artifactId</property>
                                    <message>Project artifactId must follow JD3 pattern</message>
                                    <regex>^(jdplus)-(\w+)(?:-(base|cli|desktop|bom)(?:-(\w+))?)?$</regex>
                                </requireProperty>
                                <requireReleaseDeps>
                                    <onlyWhenRelease>true</onlyWhenRelease>
                                </requireReleaseDeps>
                                <requireUpperBoundDeps/>
                                <!-- 2.2 extra-enforcer-rules -->
                                <banCircularDependencies/>
                                <banDuplicateClasses>
                                    <!-- Fix org.netbeans.external:net-java-html-boot:jar duplicate classes -->
                                    <ignoreWhenIdentical>true</ignoreWhenIdentical>
                                </banDuplicateClasses>
                                <enforceBytecodeVersion>
                                    <maxJdkVersion>${maven.compiler.release}</maxJdkVersion>
                                    <ignoredScopes>
                                        <ignoreScope>test</ignoreScope>
                                    </ignoredScopes>
                                </enforceBytecodeVersion>
                                <!-- 2.3 pomchecker-enforcer-rules -->
                                <checkMavenCentral
                                        implementation="org.kordamp.maven.enforcer.checker.CheckMavenCentral">
                                    <release>false</release>
                                    <strict>false</strict>
                                </checkMavenCentral>
                            </rules>
                        </configuration>
                    </execution>
                    <execution>
                        <id>check-project</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <inherited>false</inherited>
                        <configuration>
                            <rules>
                                <!-- 2.4 required project files -->
                                <requireFilesExist>
                                    <files>
                                        <file>${project.basedir}/.gitignore</file>
                                        <file>${project.basedir}/CHANGELOG.md</file>
                                        <file>${project.basedir}/LICENSE</file>
                                        <file>${project.basedir}/lombok.config</file>
                                        <file>${project.basedir}/README.md</file>
                                    </files>
                                </requireFilesExist>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.gaul</groupId>
                <artifactId>modernizer-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>modernizer</goal>
                        </goals>
                        <configuration>
                            <!-- 2.5 upgradable source code -->
                            <javaVersion>${maven.compiler.release}</javaVersion>
                            <!-- 2.6 forbidden source code -->
                            <exclusionPatterns>
                                <!--<exclusionPattern>com/google/common/base/Optional.*</exclusionPattern>-->
                            </exclusionPatterns>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>de.thetaphi</groupId>
                <artifactId>forbiddenapis</artifactId>
                <configuration>
                    <failOnUnsupportedJava>false</failOnUnsupportedJava>
                    <bundledSignatures>
                        <!-- 2.7 forbidden APIs -->
                        <bundledSignature>jdk-unsafe</bundledSignature>
                        <bundledSignature>jdk-deprecated</bundledSignature>
                        <bundledSignature>jdk-internal</bundledSignature>
                        <bundledSignature>jdk-non-portable</bundledSignature>
                        <bundledSignature>jdk-reflection</bundledSignature>
                    </bundledSignatures>
                    <suppressAnnotations>
                        <suppressAnnotation>javax.annotation.processing.Generated</suppressAnnotation>
                        <suppressAnnotation>lombok.Generated</suppressAnnotation>
                    </suppressAnnotations>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                            <goal>testCheck</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.github.nbbrd.heylogs</groupId>
                <artifactId>heylogs-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <inherited>false</inherited>
                    </execution>
                </executions>
                <configuration>
                    <versioning>semver</versioning>
                    <tagging>prefix:v</tagging>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <!-- Disable some plugins to accelerate the build -->
        <profile>
            <id>fast-build</id>
            <properties>
                <enforcer.skip>true</enforcer.skip>
                <modernizer.skip>true</modernizer.skip>
                <heylogs.skip>true</heylogs.skip>
            </properties>
        </profile>

        <!-- Base deploy -->
        <profile>
            <id>base-deploy</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <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>
                        <executions>
                            <execution>
                                <id>attach-empty-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <sourcepath>${project.build.directory}/no-source</sourcepath>
                            <quiet>true</quiet>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.simplify4u.plugins</groupId>
                        <artifactId>sign-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Deploy SNAPSHOTS to Central Portal -->
        <profile>
            <id>snapshot-deploy</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                            <autoPublish>true</autoPublish>
                            <waitUntil>published</waitUntil>
                            <centralSnapshotsUrl>https://central.sonatype.com/repository/maven-snapshots/</centralSnapshotsUrl>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Deploy RELEASES to Central Portal -->
        <profile>
            <id>release-deploy</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                            <autoPublish>true</autoPublish>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
