<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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>fr.paris.lutece.tools</groupId>
    <artifactId>lutece-global-pom</artifactId>
    <name>Lutece global pom</name>
    <description>Parent POM shared by all Lutece projects (core, plugins, modules, sites and tools). Centralizes Java/Jakarta EE versions, build plugins configuration, reporting, code quality tooling (Checkstyle, PMD, SpotBugs, JaCoCo) and distribution settings.</description>
    <url>https://${serverUrl}/</url>
    <packaging>pom</packaging>
    <version>8.0.3</version>

    <properties>
        <!-- Misc build parameters -->
        <java.version>17</java.version>
        <!-- targetJdk is consumed by the Jenkins pipeline to select the JDK used for compilation -->
        <targetJdk>${java.version}</targetJdk>
        <maven.compiler.release>${java.version}</maven.compiler.release>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <!-- Directory -->
        <explodedDirectory>lutece</explodedDirectory>

        <!-- Lutece specific parameters -->
        <serverUrl>dev.lutece.paris.fr</serverUrl>
        <bugtrackerBaseUrl>https://${serverUrl}/bugtracker</bugtrackerBaseUrl>
        <organization.logo>https://${serverUrl}/images/banner_left.png</organization.logo>
        <github.project>lutece-platform</github.project>
        <twitter.account>LuteceFoundry</twitter.account>
        <openhub.id>7203</openhub.id>
        <componentName>globalpom</componentName>

        <!-- Build dependencies versions -->
        <maven-antrun-plugin.version>3.2.0</maven-antrun-plugin.version>
        <!-- the Ant embedded by maven-antrun-plugin above ; compile-time reference for Ant extensions (library-sql-utils) -->
        <ant.version>1.10.15</ant.version>
        <maven-site-plugin.version>3.22.0</maven-site-plugin.version>
        <maven-checkstyle-plugin.version>3.6.0</maven-checkstyle-plugin.version>
        <maven-pmd-plugin.version>3.28.0</maven-pmd-plugin.version>
        <maven-formatter-plugin.version>2.29.0</maven-formatter-plugin.version>
        <maven-war-plugin.version>3.5.1</maven-war-plugin.version>
        <maven-release-plugin.version>3.3.1</maven-release-plugin.version>
        <maven-jacoco-plugin.version>0.8.15</maven-jacoco-plugin.version>
        <maven-javadoc-plugin.version>3.12.0</maven-javadoc-plugin.version>
        <maven-surefire-plugin.version>3.5.6</maven-surefire-plugin.version>
        <maven-surefire-report-plugin.version>3.5.6</maven-surefire-report-plugin.version>
        <maven-jxr-plugin.version>3.6.0</maven-jxr-plugin.version>
        <maven-compiler-plugin.version>3.16.0</maven-compiler-plugin.version>
        <maven-taglist-plugin.version>3.2.2</maven-taglist-plugin.version>
        <maven-project-info-reports-plugin.version>3.9.0</maven-project-info-reports-plugin.version>
        <maven-clean-plugin.version>3.5.0</maven-clean-plugin.version>
        <maven-deploy-plugin.version>3.1.4</maven-deploy-plugin.version>
        <maven-install-plugin.version>3.1.4</maven-install-plugin.version>
        <maven-lutece-plugin.version>7.2.1</maven-lutece-plugin.version>
        <maven-resources-plugin.version>3.5.0</maven-resources-plugin.version>
        <lutece-maven-report.version>1.0.0</lutece-maven-report.version>
        <license-maven-plugin.version>4.1</license-maven-plugin.version>
        <maven-xdoc2md-plugin.version>1.0.3</maven-xdoc2md-plugin.version>
        <maven-scm-provider-jgit.version>2.2.1</maven-scm-provider-jgit.version>
        <ant-optional.version>1.5.3-1</ant-optional.version>
        <ant-contrib.version>1.0b3</ant-contrib.version>
        <maven-wagon-ftp.version>3.5.3</maven-wagon-ftp.version>
        <build-config.version>3.0.3</build-config.version>
        <maven-enforcer-plugin.version>3.6.3</maven-enforcer-plugin.version>
        <versions-maven-plugin.version>2.21.0</versions-maven-plugin.version>
        <!-- Dependency graph enforcer rules: blocking. A project hitting a real
             conflict can unblock itself with -Denforcer.dependencyRules.fail=false
             while it is being fixed, without disabling the Maven and Java checks. -->
        <enforcer.dependencyRules.fail>true</enforcer.dependencyRules.fail>
        <!-- Set to true to silence the dependency divergence report on a project
             where it has been reviewed and judged to be only benign cases. -->
        <enforcer.dependencyReport.skip>false</enforcer.dependencyReport.skip>
        <spotbugs-maven-plugin.version>4.9.8.2</spotbugs-maven-plugin.version>
        <findsecbugs-plugin.version>1.14.0</findsecbugs-plugin.version>
        <liberty-maven-plugin.version>3.12.3</liberty-maven-plugin.version>
        <jakarta.jakartaee-api.version>10.0.0</jakarta.jakartaee-api.version>
        <microprofile.version>7.1</microprofile.version>
        <commons.lang.version>3.20.0</commons.lang.version>
        <commons.collection4.version>4.6.0</commons.collection4.version>
        <commons.codec.version>1.22.1</commons.codec.version>
        <commons.io.version>2.22.0</commons.io.version>
        <common.beanutils.version>1.11.0</common.beanutils.version>
        <log4j-bom.version>2.26.1</log4j-bom.version>
        <jackson-bom.version>2.22.2</jackson-bom.version>
        <slf4j-api.version>2.0.19</slf4j-api.version>
        <commons-logging.version>1.4.0</commons-logging.version>
        <jboss-logging.version>3.6.3.Final</jboss-logging.version>
        <jakarta.el-api.version>5.0.1</jakarta.el-api.version>
        <jakarta.annotation-api.version>2.1.1</jakarta.annotation-api.version>

        <!-- Runtime dependencies versions -->
        <library-lutece-unit-testing.version>5.0.2</library-lutece-unit-testing.version>
        <test-jaxb-runtime.version>4.0.9</test-jaxb-runtime.version>
        <test-hibernate-validator.version>8.0.5.Final</test-hibernate-validator.version>
        <test-expressly.version>5.0.0</test-expressly.version>
        <junit-bom.version>5.14.4</junit-bom.version>

        <!-- Single source of truth for the JDBC connectors: inheriting projects
             (lutece-core included) must reference ${mariadb.version},
             ${postgresql.version} and ${hsqldb.version} without redeclaring them.
             The connectors are activated by the db profiles at the end of this pom. -->
        <mariadb.version>3.5.10</mariadb.version>
        <postgresql.version>42.7.13</postgresql.version>
        <hsqldb.version>2.7.4</hsqldb.version>

        <!-- directory provided by the artifact fr.paris.lutece.tools:build-config -->
        <build-config.location>build-config</build-config.location>

        <!-- parameters to override db.properties with dynamic parameters during the antrun:run goal -->
        <antrun-lutece-db-properties>db.properties</antrun-lutece-db-properties>
        <!-- by default these are not used because there are no markers in db.properties, only in db-test-*.properties -->
        <lutece-antrun-db-host>localhost</lutece-antrun-db-host>
        <lutece-antrun-db-name>lutece</lutece-antrun-db-name>
        <lutece-antrun-db-user>root</lutece-antrun-db-user>
        <lutece-antrun-db-password>motdepasse</lutece-antrun-db-password>

        <!-- Sonar parameters-->
        <sonar.host.url>https://${serverUrl}/sonar</sonar.host.url>
        <sonar.sources>pom.xml,src/java,webapp</sonar.sources>
        <sonar.tests>src/test</sonar.tests>
        <sonar.sourceEncoding>${project.build.sourceEncoding}</sonar.sourceEncoding>
        <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
        <sonar.coverage.jacoco.xmlReportPaths>target/site/jacoco/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
        <!-- Exclude vendor JS/CSS libraries from CPD and duplication analysis -->
        <sonar.cpd.exclusions>webapp/js/**/lib/**,webapp/themes/**/lib/**,webapp/themes/**/shared/js/lib/**</sonar.cpd.exclusions>

        <current.year>${maven.build.timestamp}</current.year>
        <maven.build.timestamp.format>yyyy</maven.build.timestamp.format>

        <!-- Setting Liberty configuration with Maven project properties-->
        <liberty.defaultVar.app.context.root>${project.artifactId}</liberty.defaultVar.app.context.root>
        <liberty.defaultVar.build.directory>${project.build.directory}</liberty.defaultVar.build.directory>
        <liberty.defaultVar.appLocation>${project.artifactId}-${project.version}.war</liberty.defaultVar.appLocation>

    </properties>

    <licenses>
        <license>
            <name>Lutece license</name>
            <url>https://${serverUrl}/LICENSE.TXT</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <organization>
        <name>City of Paris</name>
        <url>https://lutece.paris.fr</url>
    </organization>

    <issueManagement>
        <system>bugtracker Issue</system>
        <url>${bugtrackerBaseUrl}/projects/${componentName}/issues</url>
    </issueManagement>

    <ciManagement>
        <system>jenkins</system>
        <url>https://${serverUrl}/jenkins/</url>
        <notifiers>
            <notifier>
                <type>mail</type>
                <configuration>
                    <address>lutece@paris.fr</address>
                </configuration>
            </notifier>
        </notifiers>
    </ciManagement>

    <repositories>
        <repository>
            <id>lutece</id>
            <name>luteceRepository</name>
            <url>https://${serverUrl}/maven_repository</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>luteceSnapshot</id>
            <name>luteceSnapshot</name>
            <url>https://${serverUrl}/snapshot_repository</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>lutece</id>
            <name>luteceRepository</name>
            <url>https://${serverUrl}/maven_repository</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
        <pluginRepository>
            <id>luteceSnapshot</id>
            <name>luteceSnapshot</name>
            <url>https://${serverUrl}/snapshot_repository</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

    <!-- JAKARTA 10 API -->
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-bom</artifactId>
                <version>${log4j-bom.version}</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson</groupId>
                <artifactId>jackson-bom</artifactId>
                <version>${jackson-bom.version}</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
            <!-- Ant extensions compile against the Ant of maven-antrun-plugin ; never shipped, the Ant runtime provides it -->
            <dependency>
                <groupId>org.apache.ant</groupId>
                <artifactId>ant</artifactId>
                <version>${ant.version}</version>
                <scope>provided</scope>
            </dependency>
            <!--
              Circular by design: library-lutece-unit-testing has this pom as its parent,
              while this pom manages its version. Harmless at build time, because
              dependencyManagement is never resolved unless a project actually declares
              the dependency: this pom builds fine even when the version below points at
              an artifact that does not exist yet.
              Two consequences at release time:
               - release:prepare does NOT inspect dependencyManagement for SNAPSHOTs (it
                 only checks the resolved dependencies, the plugins and the parent), so
                 nothing stops you from releasing this pom while the version below is a
                 SNAPSHOT. That would publish a released parent forcing every consuming
                 project onto a SNAPSHOT. Always set a release version here first.
               - release THIS pom first, pointing at the not-yet-published library
                 version, then release the library against it. The reverse order cannot
                 work: release:prepare does check the parent, so the library needs a
                 released parent. Keep the window between the two short, since a project
                 bumping its parent in between would fail to resolve the library.
              Note the version below cannot lag one release behind either: the
              jboss-logging / jakarta.el-api / jakarta.annotation-api versions managed
              further down are calibrated for the Jakarta EE 10 stack of the library
              version named here. Pointing at a library built on a different CDI
              generation makes requireUpperBoundDeps fail in every consuming project.
            -->
            <dependency>
                <groupId>fr.paris.lutece.plugins</groupId>
                <artifactId>library-lutece-unit-testing</artifactId>
                <version>${library-lutece-unit-testing.version}</version>
                <type>jar</type>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.hibernate.validator</groupId>
                <artifactId>hibernate-validator</artifactId>
                <version>${test-hibernate-validator.version}</version>
                <scope>test</scope>
            </dependency>
            <!--
              Jakarta EL implementation needed at runtime by hibernate-validator's
              message interpolation. org.glassfish:jakarta.el never got a release past
              5.0.0-M1: the artifact was renamed to org.glassfish.expressly:expressly,
              which is also what hibernate-validator itself depends on nowadays.
            -->
            <dependency>
                <groupId>org.glassfish.expressly</groupId>
                <artifactId>expressly</artifactId>
                <version>${test-expressly.version}</version>
                <type>jar</type>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.glassfish.jaxb</groupId>
                <artifactId>jaxb-runtime</artifactId>
                <version>${test-jaxb-runtime.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
			  <groupId>org.junit</groupId>
			  <artifactId>junit-bom</artifactId>
			  <version>${junit-bom.version}</version>
			  <type>pom</type>
			  <scope>import</scope>
			</dependency>

            <!--
              commons-logging is a transitive dependency of many libraries with different versions.
              Specify the latest version here to not depend on the order of declaration.
              When we manage to get rid of commons-logging, we can safely remove this dependency.
              Lutece-core depend on commons-beanutils libraries that use commons-logging.
            -->
            <dependency>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
                <version>${commons-logging.version}</version>
            </dependency>
            <!--
              jboss-logging is a transitive dependency of hibernate-validator (3.4.3),
              Weld (3.5.0) and SmallRye Config (3.6.3) with different versions. SmallRye
              needs the Logger.getMessageLogger(MethodHandles.Lookup, ...) overload added
              in 3.6, so resolving a nearer older version breaks every test at startup
              with a NoSuchMethodError.
              Specify the latest version here to not depend on the order of declaration.
            -->
            <dependency>
                <groupId>org.jboss.logging</groupId>
                <artifactId>jboss-logging</artifactId>
                <version>${jboss-logging.version}</version>
            </dependency>
            <!--
              Same situation for jakarta.el-api: expressly (the test EL implementation)
              requests 5.0.0 while Weld requests 5.0.1. Align on the highest so the test
              classpath does not depend on declaration order.
            -->
            <dependency>
                <groupId>jakarta.el</groupId>
                <artifactId>jakarta.el-api</artifactId>
                <version>${jakarta.el-api.version}</version>
            </dependency>
            <!--
              Same again for jakarta.annotation-api: CDI 4.0.1 and interceptor-api 2.1.0
              request 2.1.0 while Weld and SmallRye Config request 2.1.1.
            -->
            <dependency>
                <groupId>jakarta.annotation</groupId>
                <artifactId>jakarta.annotation-api</artifactId>
                <version>${jakarta.annotation-api.version}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j-api.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>${commons.lang.version}</version>
            </dependency>
			<dependency>
			    <groupId>org.apache.commons</groupId>
			    <artifactId>commons-collections4</artifactId>
			    <version>${commons.collection4.version}</version>
			    
			</dependency>			            
            <!--
              commons-codec and commons-io reach almost every project transitively, through
              POI, Tika, ical4j, liquibase, httpclient and others, each pinning its own
              version. Whichever sits nearest in the graph wins, which regularly downgrades
              what lutece-core ships and trips requireUpperBoundDeps in consuming projects.
              Managing them here settles the platform version once.
            -->
            <dependency>
                <groupId>commons-codec</groupId>
                <artifactId>commons-codec</artifactId>
                <version>${commons.codec.version}</version>
            </dependency>
            <dependency>
                <groupId>commons-io</groupId>
                <artifactId>commons-io</artifactId>
                <version>${commons.io.version}</version>
            </dependency>
            <!-- BeanUtils -->
            <dependency>
                <groupId>commons-beanutils</groupId>
                <artifactId>commons-beanutils</artifactId>
                <version>${common.beanutils.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>jakarta.platform</groupId>
            <artifactId>jakarta.jakartaee-api</artifactId>
            <version>${jakarta.jakartaee-api.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.microprofile</groupId>
            <artifactId>microprofile</artifactId>
            <version>${microprofile.version}</version>
            <scope>provided</scope>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>fr.paris.lutece.tools</groupId>
            <artifactId>build-config</artifactId>
            <version>${build-config.version}</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    <reporting>
        <plugins>
            <!--    JXR       -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jxr-plugin</artifactId>
                <version>${maven-jxr-plugin.version}</version>
            </plugin>
            <!--    PROJECT INFO       -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>${maven-project-info-reports-plugin.version}</version>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>index</report>
                            <report>summary</report>
                            <report>dependencies</report>
                            <report>ci-management</report>
                            <report>issue-management</report>
                            <report>licenses</report>
                            <report>scm</report>
                        </reports>
                    </reportSet>
                </reportSets>
                <configuration>
                    <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
                </configuration>
            </plugin>
            <!--    CHECKSTYLE       -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${maven-checkstyle-plugin.version}</version>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>checkstyle</report>
                        </reports>
                    </reportSet>
                </reportSets>
                <configuration>
                    <configLocation>${build-config.location}/lutece_checks.xml</configLocation>
                    <headerLocation>${build-config.location}/checkstyle-header.txt</headerLocation>
                </configuration>
            </plugin>
            <!--    PMD       -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
                <version>${maven-pmd-plugin.version}</version>
                <configuration>
                    <linkXref>true</linkXref>
                    <rulesets>
                        <ruleset>${build-config.location}/pmd_categories/pmd-lutece.xml</ruleset>
                    </rulesets>
                    <failsOnError>false</failsOnError>
                    <failOnViolation>false</failOnViolation>
                    <printFailingErrors>true</printFailingErrors>
                    <!-- Exclude vendor JS/CSS libraries from CPD analysis -->
                    <excludeRoots>
                        <excludeRoot>webapp/js/lib</excludeRoot>
                        <excludeRoot>webapp/themes</excludeRoot>
                    </excludeRoots>
                </configuration>
            </plugin>
            <!--    TAG LIST       -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>taglist-maven-plugin</artifactId>
                <version>${maven-taglist-plugin.version}</version>
                <configuration>
                    <tags>
                        <tag>TODO</tag>
                        <tag>FIXME</tag>
                        <tag>@todo</tag>
                        <tag>@deprecated</tag>
                        <tag>DOCUMENT_ME</tag>
                        <tag>NOT_YET_DOCUMENTED</tag>
                    </tags>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
                <version>${spotbugs-maven-plugin.version}</version>
                <configuration>
                    <xmlOutput>true</xmlOutput>
                </configuration>
            </plugin>
            <!--     SUREFIRE       -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
                <version>${maven-surefire-report-plugin.version}</version>
                <configuration>
                    <showSuccess>true</showSuccess>
                </configuration>
            </plugin>
            <!--      JACOCO        -->
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${maven-jacoco-plugin.version}</version>
                <reportSets>
                    <reportSet>
                        <reports>
                            <!-- select non-aggregate reports -->
                            <report>report</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>

            <!--       LUTECE        -->
            <plugin>
                <groupId>fr.paris.lutece.tools</groupId>
                <artifactId>lutece-report-maven-plugin</artifactId>
                <version>${lutece-maven-report.version}</version>
            </plugin>
        </plugins>
    </reporting>

    <build>
        <sourceDirectory>src/java</sourceDirectory>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>src/java</directory>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
            </testResource>
            <testResource>
                <directory>target/lutece/WEB-INF/</directory>
                <excludes>
                    <exclude>lib</exclude>
                </excludes>
                <targetPath>WEB-INF</targetPath>
            </testResource>
        </testResources>

        <pluginManagement>
            <plugins>
                <!-- Version audit tooling, not bound to the lifecycle.
                     Usage : mvn versions:display-plugin-updates
                             mvn versions:display-property-updates
                             mvn versions:display-dependency-updates -->
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>versions-maven-plugin</artifactId>
                    <version>${versions-maven-plugin.version}</version>
                    <configuration>
                        <!-- never propose milestones, betas or release candidates -->
                        <ruleSet>
                            <ignoreVersions>
                                <ignoreVersion>
                                    <type>regex</type>
                                    <version>(?i).*-(alpha|beta|m|rc|cr)[-.]?\d*</version>
                                </ignoreVersion>
                            </ignoreVersions>
                        </ruleSet>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>${maven-enforcer-plugin.version}</version>
                <executions>
                    <execution>
                        <id>enforce-maven</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <!-- Enforce maven [3.9,4.0.0) : Maven 4 is not supported yet,
                                     the build plugins are still on their 3.x lines.
                                     Recommended version : the latest Maven 3.9.x -->
                                <requireMavenVersion>
                                    <version>[3.9,4.0.0)</version>
                                </requireMavenVersion>
                                <!-- Enforce Java [17,) -->
                                <requireJavaVersion>
                                    <version>17</version>
                                </requireJavaVersion>
                            </rules>
                        </configuration>
                    </execution>
                    <execution>
                        <!-- Separate execution on purpose: <fail> applies to the whole
                             execution, so switching these rules off must not switch off
                             the Maven and Java version checks along with them. -->
                        <id>enforce-dependencies</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <fail>${enforcer.dependencyRules.fail}</fail>
                            <rules>
                                <!-- Fails when the resolved version of a transitive
                                     dependency is lower than what another dependency
                                     requires: turns a runtime NoSuchMethodError into a
                                     build-time report. -->
                                <requireUpperBoundDeps>
                                    <excludedScopes>
                                        <excludedScope>provided</excludedScope>
                                    </excludedScopes>
                                </requireUpperBoundDeps>
                                <!-- Bans declaring the same groupId:artifactId twice in
                                     a single POM, where one declaration is silently
                                     ignored. -->
                                <banDuplicatePomDependencyVersions />
                            </rules>
                        </configuration>
                    </execution>
                    <execution>
                        <!-- Report only, never fails: lists every version divergence in
                             the graph, including the harmless ones where the resolved
                             version is already the higher one. Gives visibility on what
                             requireUpperBoundDeps lets through, without turning benign
                             divergences into build failures. -->
                        <id>report-dependency-divergence</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <skip>${enforcer.dependencyReport.skip}</skip>
                            <fail>false</fail>
                            <rules>
                                <dependencyConvergence>
                                    <excludedScopes>
                                        <excludedScope>provided</excludedScope>
                                    </excludedScopes>
                                </dependencyConvergence>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!--    JAVADOC       -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven-javadoc-plugin.version}</version>
                <configuration>
                    <show>public</show>
                    <additionalOptions>
                        <additionalOption>-Xdoclint:none</additionalOption>
                    </additionalOptions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${maven-jacoco-plugin.version}</version>
                <executions>
                    <execution>
                        <id>prepare-agent</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <propertyName>jacoco.agent.argLine</propertyName>
                            <destFile>target/jacoco.exec</destFile>
                        </configuration>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-release-plugin</artifactId>
                <version>${maven-release-plugin.version}</version>
                <configuration>
                    <providerImplementations>
                        <git>jgit</git>
                    </providerImplementations>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.scm</groupId>
                        <artifactId>maven-scm-provider-jgit</artifactId>
                        <version>${maven-scm-provider-jgit.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <artifactId>maven-site-plugin</artifactId>
                <version>${maven-site-plugin.version}</version>
                <configuration>
                    <locales>fr,en</locales>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-descriptor</id>
                        <goals>
                            <goal>attach-descriptor</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>fr.paris.lutece.tools</groupId>
                <artifactId>lutece-maven-plugin</artifactId>
                <extensions>true</extensions>
                <version>${maven-lutece-plugin.version}</version>
                <configuration>
                    <localConfDirectory>${localConfDirectory}</localConfDirectory>
                </configuration>
            </plugin>
            <plugin>
                <groupId>fr.paris.lutece.tools</groupId>
                <artifactId>xdoc2md-maven-plugin</artifactId>
                <version>${maven-xdoc2md-plugin.version}</version>
            </plugin>
            <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-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin.version}</version>
                <configuration>
                    <forkCount>1</forkCount>
                    <reuseForks>true</reuseForks>
                    <argLine>@{jacoco.agent.argLine}</argLine>
                    <testFailureIgnore>true</testFailureIgnore>
                    <excludes>
                        <exclude>**/MainTest.java</exclude>
                        <exclude>**/TestRunner.java</exclude>
                        <exclude>**/LuteceTestCase.java</exclude>
                        <exclude>**/AllTests.java</exclude>
                        <!-- lutece:exploded copies target/lutece/WEB-INF into target/test-classes:
                             do not scan the webapp classes, they are not tests -->
                        <exclude>**/WEB-INF/**</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>${maven-antrun-plugin.version}</version>
                <configuration>
                    <target>
                        <taskdef resource="net/sf/antcontrib/antcontrib.properties" />

                        <!-- replace markers in db-test-*.properties to allow command line values for tests -->
                        <if>
                            <not>
                                <equals arg1="${antrun-lutece-db-properties}" arg2="db.properties" />
                            </not>
                            <then>
                                <copy file="${basedir}/target/${explodedDirectory}/WEB-INF/sql/conf/${antrun-lutece-db-properties}" tofile="${basedir}/target/${explodedDirectory}/WEB-INF/conf/db.properties" overwrite="true" />
                                <replace file="${basedir}/target/${explodedDirectory}/WEB-INF/conf/db.properties" token="@lutece_antrun_db_host@" value="${lutece-antrun-db-host}" />
                                <replace file="${basedir}/target/${explodedDirectory}/WEB-INF/conf/db.properties" token="@lutece_antrun_db_name@" value="${lutece-antrun-db-name}" />
                                <replace file="${basedir}/target/${explodedDirectory}/WEB-INF/conf/db.properties" token="@lutece_antrun_db_user@" value="${lutece-antrun-db-user}" />
                                <replace file="${basedir}/target/${explodedDirectory}/WEB-INF/conf/db.properties" token="@lutece_antrun_db_password@" value="${lutece-antrun-db-password}" />
                            </then>
                        </if>

                        <!-- setup recording of our main script to generate a test report -->
                        <property name="antrun_report_dir" value="target/surefire-reports/" />
                        <property name="antrun_report_basename" value="antrun_report" />
                        <property name="antrun_report_txt" value="${antrun_report_dir}/${antrun_report_basename}.txt" />
                        <mkdir dir="${basedir}/${antrun_report_dir}" />
                        <record name="${basedir}/${antrun_report_txt}" append="true" action="start" />
                        <!-- run our main ant script -->
                        <ant antfile="${basedir}/target/${explodedDirectory}/WEB-INF/sql/build.xml" dir="${basedir}/target/${explodedDirectory}/WEB-INF/sql/">
                            <target name="all" />
                        </ant>
                        <record name="${basedir}/${antrun_report_txt}" action="stop" />
                        <!-- Load recording of our main script to generate the xml report -->
                        <loadfile srcfile="${basedir}/${antrun_report_txt}" property="antrun_failures">
                            <filterchain>
                                <linecontainsregexp>
                                    <regexp pattern="Failed to execute" />
                                </linecontainsregexp>
                            </filterchain>
                        </loadfile>

                        <!-- Generate xml report (Junit format) -->
                        <property name="antrun_report_xml" value="${antrun_report_dir}/${antrun_report_basename}.xml" />
                        <if>
                            <equals arg1="${antrun_failures}" arg2="$${antrun_failures}" />
                            <then>
                                <!-- No failures -->
                                <echoxml file="${basedir}/${antrun_report_xml}">
                                    <testsuite name="antrunsql" time="1" tests="1" errors="0" skipped="0" failures="0">
                                        <testcase name="antrunsql" classname="antrunsql" time="1" />
                                    </testsuite>
                                </echoxml>
                            </then>
                            <else>
                                <!-- failures -->
                                <echoxml file="${basedir}/${antrun_report_xml}">
                                    <testsuite name="antrunsql" time="1" tests="1" errors="1" skipped="0" failures="0">
                                        <testcase name="antrunsql" classname="antrunsql" time="1">
                                            <failure type="antrunsql">${antrun_failures}</failure>
                                        </testcase>
                                    </testsuite>
                                </echoxml>
                            </else>
                        </if>
                    </target>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>ant</groupId>
                        <artifactId>ant-optional</artifactId>
                        <version>${ant-optional.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>ant-contrib</groupId>
                        <artifactId>ant-contrib</artifactId>
                        <version>${ant-contrib.version}</version>
                        <exclusions>
                            <exclusion>
                                <groupId>ant</groupId>
                                <artifactId>ant</artifactId>
                            </exclusion>
                        </exclusions>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>${maven-war-plugin.version}</version>
                <configuration>
                    <warSourceDirectory>${basedir}/webapp</warSourceDirectory>
                </configuration>
            </plugin>
            <plugin>
                <groupId>net.revelc.code.formatter</groupId>
                <artifactId>formatter-maven-plugin</artifactId>
                <version>${maven-formatter-plugin.version}</version>
                <configuration>
                    <configFile>${build-config.location}/lutece_formatter.xml</configFile>
                    <compilerSource>${java.version}</compilerSource>
                    <compilerCompliance>${java.version}</compilerCompliance>
                    <compilerTargetPlatform>${java.version}</compilerTargetPlatform>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>${license-maven-plugin.version}</version>
                <configuration>
                    <licenseSets>
                        <licenseSet>
                            <header>${build-config.location}/LICENSE.TXT</header>
                            <includes>
                                <include>src/java/**/*.java</include>
                                <include>src/test/java/**/*.java</include>
                            </includes>
                        </licenseSet>
                    </licenseSets>
                    <mapping>
                        <java>slashstar_style</java>
                    </mapping>
                    <quiet>true</quiet>
                    <failIfMissing>false</failIfMissing>
                    <properties>
                        <current.year>${current.year}</current.year>
                    </properties>
                </configuration>
                <executions>
                    <execution>
                        <id>check-license</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <phase>process-sources</phase>
                    </execution>
                    <execution>
                        <id>default-cli</id>
                        <configuration>
                            <quiet>false</quiet>
                            <failIfMissing>true</failIfMissing>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${maven-checkstyle-plugin.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>fr.paris.lutece.tools</groupId>
                        <artifactId>build-config</artifactId>
                        <version>${build-config.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
                <version>${spotbugs-maven-plugin.version}</version>
                <configuration>
                    <plugins>
                        <plugin>
                            <groupId>com.h3xstream.findsecbugs</groupId>
                            <artifactId>findsecbugs-plugin</artifactId>
                            <version>${findsecbugs-plugin.version}</version>
                        </plugin>
                    </plugins>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>fr.paris.lutece.tools</groupId>
                        <artifactId>build-config</artifactId>
                        <version>${build-config.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <version>${maven-clean-plugin.version}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-install-plugin</artifactId>
                <version>${maven-install-plugin.version}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>${maven-deploy-plugin.version}</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>${maven-resources-plugin.version}</version>
            </plugin>
            <plugin>
                <groupId>fr.paris.lutece.tools</groupId>
                <artifactId>liberty-maven-plugin</artifactId>
                <version>${liberty-maven-plugin.version}</version>
                <configuration>
                    <serverName>luteceServer</serverName>
                </configuration>
            </plugin>
        </plugins>

        <extensions>
            <!-- Adding the build-config jar containing misc files to the classpath -->
            <!-- used by different plugins, like checkstyle, pmd, jalopy, formatter, license -->
            <extension>
                <groupId>fr.paris.lutece.tools</groupId>
                <artifactId>build-config</artifactId>
                <version>${build-config.version}</version>
            </extension>
            <!-- Enabling the use of FTP -->
            <extension>
                <groupId>org.apache.maven.wagon</groupId>
                <artifactId>wagon-ftp</artifactId>
                <version>${maven-wagon-ftp.version}</version>
            </extension>
        </extensions>
    </build>

    <distributionManagement>
        <repository>
            <id>lutece_releases_repository</id>
            <url>https://${serverUrl}/nexus/content/repositories/lutece_releases_repository</url>
        </repository>

        <snapshotRepository>
            <uniqueVersion>true</uniqueVersion>
            <id>lutece_snapshots_repository</id>
            <url>https://${serverUrl}/nexus/content/repositories/lutece_snapshots_repository</url>
        </snapshotRepository>

        <site>
            <id>lutece_ftp_site_maven</id>
            <url>ftp://site-deploy.${serverUrl}/site/plugins</url>
        </site>
    </distributionManagement>

    <scm>
        <connection>scm:git:https://github.com/lutece-platform/tools-maven-global-pom.git</connection>
        <developerConnection>scm:git:https://github.com/lutece-platform/tools-maven-global-pom.git</developerConnection>
        <url>https://github.com/lutece-platform/tools-maven-global-pom.git</url>
        <tag>HEAD</tag>
    </scm>

    <profiles>
        <!-- databases drivers, for tests only -->
        <!-- Do not activate these for releases -->
        <!-- Choose your driver during tests with one of the following: -->
        <!--   mvn -Dlutece-test-mariadb ... -->
        <!--   mvn -Dlutece-test-mysql ... (historical alias of lutece-test-mariadb, kept so existing Jenkins pipelines keep working) -->
        <!--   mvn -Dlutece-test-hsql ... -->
        <!--   mvn -Dlutece-test-postgresql ... -->
        <profile>
            <id>lutece-test-mariadb</id>
            <activation>
                <property>
                    <name>lutece-test-mariadb</name>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>org.mariadb.jdbc</groupId>
                    <artifactId>mariadb-java-client</artifactId>
                    <version>${mariadb.version}</version>
                    <optional>true</optional>
                </dependency>
            </dependencies>
            <properties>
                <antrun-lutece-db-properties>db-test-mariadb.properties</antrun-lutece-db-properties>
            </properties>
        </profile>
        <!-- Historical alias of lutece-test-mariadb, kept so existing Jenkins
             pipelines invoking -Dlutece-test-mysql keep working unchanged.
             db-test-mysql.properties has the same content as db-test-mariadb.properties. -->
        <profile>
            <id>lutece-test-mysql</id>
            <activation>
                <property>
                    <name>lutece-test-mysql</name>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>org.mariadb.jdbc</groupId>
                    <artifactId>mariadb-java-client</artifactId>
                    <version>${mariadb.version}</version>
                    <optional>true</optional>
                </dependency>
            </dependencies>
            <properties>
                <antrun-lutece-db-properties>db-test-mysql.properties</antrun-lutece-db-properties>
            </properties>
        </profile>
        <profile>
            <id>lutece-test-postgresql</id>
            <activation>
                <property>
                    <name>lutece-test-postgresql</name>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>org.postgresql</groupId>
                    <artifactId>postgresql</artifactId>
                    <version>${postgresql.version}</version>
                    <optional>true</optional>
                </dependency>
            </dependencies>
            <properties>
                <antrun-lutece-db-properties>db-test-postgresql.properties</antrun-lutece-db-properties>
            </properties>
        </profile>
        <profile>
            <id>lutece-test-hsql</id>
            <activation>
                <property>
                    <name>lutece-test-hsql</name>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>org.hsqldb</groupId>
                    <artifactId>hsqldb</artifactId>
                    <version>${hsqldb.version}</version>
                    <optional>true</optional>
                </dependency>
            </dependencies>
            <properties>
                <antrun-lutece-db-properties>db-test-hsql.properties</antrun-lutece-db-properties>
            </properties>
        </profile>

    </profiles>

</project>
