<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (C) 2000 - 2026 Silverpeas

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as
    published by the Free Software Foundation, either version 3 of the
    License, or (at your option) any later version.

    As a special exception to the terms and conditions of version 3.0 of
    the GPL, you may redistribute this Program in connection with Free/Libre
    Open Source Software ("FLOSS") applications as described in Silverpeas's
    FLOSS exception.  You should have received a copy of the text describing
    the FLOSS exception, and it is also available here:
    "https://www.silverpeas.com/legal/licensing"

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.

-->

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

  <modelVersion>4.0.0</modelVersion>
  <packaging>pom</packaging>
  <artifactId>silverpeas-project</artifactId>
  <groupId>org.silverpeas</groupId>
  <version>2.0-build260921</version>
  <name>Parent POM</name>
  <description>
    Silverpeas is an open-source project to build and run a Collaborative and Social Web Portal
    in order to facilitate the collaboration and the sharing among the users.
  </description>

  <organization>
    <name>Silverpeas</name>
    <url>https://www.silverpeas.org</url>
  </organization>

  <scm>
    <connection>scm:git:git@github.com:Silverpeas/Silverpeas-Project.git</connection>
    <developerConnection>scm:git:git@github.com:Silverpeas/Silverpeas-Project.git</developerConnection>
    <url>https://gitub.com/Silverpeas/Silverpeas-Project.git</url>
    <tag>HEAD</tag>
  </scm>

  <repositories>
    <repository>
      <id>Silverpeas</id>
      <layout>default</layout>
      <name>Silverpeas Repository</name>
      <url>https://nexus3.silverpeas.org/repository/silverpeas</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>Silverpeas</id>
      <layout>default</layout>
      <name>Silverpeas Repository</name>
      <url>https://nexus3.silverpeas.org/repository/silverpeas</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </pluginRepository>
  </pluginRepositories>

  <distributionManagement>
    <repository>
      <id>silverpeas</id>
      <name>Repository Silverpeas</name>
      <layout>default</layout>
      <url>https://nexus3.silverpeas.org/repository/releases/</url>
    </repository>
    <snapshotRepository>
      <id>silverpeas-snapshots</id>
      <name>Snapshots Repository Silverpeas</name>
      <layout>default</layout>
      <url>https://nexus3.silverpeas.org/repository/snapshots/</url>
    </snapshotRepository>
    <site>
      <id>silverpeas_repository</id>
      <url>scp://www.silverpeas.org/var/www/docs</url>
    </site>
  </distributionManagement>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>io.swagger.core.v3</groupId>
        <artifactId>swagger-annotations-jakarta</artifactId>
        <version>${swagger.version}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>io.swagger.core.v3</groupId>
        <artifactId>swagger-core-jakarta</artifactId>
        <version>${swagger.version}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>org.silverpeas</groupId>
        <artifactId>silverpeas-dependencies-bom</artifactId>
        <version>${silverpeas.bom.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>

      <dependency>
        <groupId>org.silverpeas</groupId>
        <artifactId>silverpeas-test-dependencies-bom</artifactId>
        <version>${silverpeas.bom.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <properties>
    <!-- Swagger generates the documentation of the REST API, Redoc renders it -->
    <swagger.version>2.2.54</swagger.version>
    <redoc.version>2.5.0</redoc.version>
    <!-- only a module publishing the documentation of the REST API strips its Maven site -->
    <strip.maven.site.skip>true</strip.maven.site.skip>
    <!-- property used by the CI to both deploy a build version and release the next stable version -->
    <next.release>2.0</next.release>
    <silverpeas.bom.version>2.0-build260921</silverpeas.bom.version>
    <maven.compiler.release>21</maven.compiler.release>
    <surefire.version>3.5.2</surefire.version>
    <wagon.version>3.5.3</wagon.version>
    <wildfly.version>39.0.1.Final</wildfly.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <netbeans.hint.license>agpl30</netbeans.hint.license>
  </properties>

  <build>
    <testResources>
      <testResource>
        <directory>src/test/resources</directory>
        <filtering>true</filtering>
        <includes>
          <include>**/*.properties</include>
        </includes>
      </testResource>
      <testResource>
        <directory>src/test/resources</directory>
        <filtering>false</filtering>
        <excludes>
          <exclude>**/*.properties</exclude>
        </excludes>
      </testResource>
    </testResources>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jarsigner-plugin</artifactId>
          <version>3.0.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.3.0</version>
          <configuration>
            <encoding>UTF-8</encoding>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>3.5.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-war-plugin</artifactId>
          <version>3.3.2</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.13.0</version>
          <configuration>
            <release>${maven.compiler.release}</release>
            <encoding>UTF-8</encoding>
            <forceJavacCompilerUse>true</forceJavacCompilerUse>
            <showDeprecation>true</showDeprecation>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.3.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-clean-plugin</artifactId>
          <version>3.2.0</version>
          <executions>
            <!-- a module publishing the documentation of the REST API publishes nothing else:
                 what the Maven site brings along is dropped once the site has been built, before
                 it gets published. The clean plugin being part of the default lifecycle, this
                 execution applies to any project inheriting from this POM and would then wipe out
                 the Maven site of such a project; it is hence disabled by default and only a
                 module documenting the REST API opts in it by setting strip.maven.site.skip to
                 false -->
            <execution>
              <id>strip-maven-site</id>
              <phase>post-site</phase>
              <goals>
                <goal>clean</goal>
              </goals>
              <configuration>
                <skip>${strip.maven.site.skip}</skip>
                <excludeDefaultDirectories>true</excludeDefaultDirectories>
                <filesets>
                  <fileset>
                    <directory>${project.build.directory}/site</directory>
                    <includes>
                      <include>**</include>
                    </includes>
                    <excludes>
                      <exclude>index.html</exclude>
                      <exclude>openapi.json</exclude>
                      <exclude>openapi.yaml</exclude>
                      <exclude>redoc.standalone.js</exclude>
                    </excludes>
                  </fileset>
                </filesets>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>${surefire.version}</version>
          <configuration>
            <includes>
              <include>**/*Test.java</include>
              <include>**/*TestSuite.java</include>
            </includes>
            <properties>
              <configurationParameters>
                junit.jupiter.execution.parallel.enabled=false
                junit.jupiter.execution.parallel.config.strategy=dynamic
                junit.jupiter.execution.parallel.config.dynamic.factor=1
              </configurationParameters>
            </properties>
            <systemPropertyVariables>
              <user.timezone>Europe/Paris</user.timezone>
              <user.language>fr</user.language>
              <user.country>FR</user.country>
            </systemPropertyVariables>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>${surefire.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>3.4.2</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>3.2.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>3.0.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-install-plugin</artifactId>
          <version>3.0.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>3.12.1</version>
          <dependencies>
            <dependency>
              <groupId>org.apache.maven.wagon</groupId>
              <artifactId>wagon-ssh</artifactId>
              <version>${wagon.version}</version>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.4.1</version>
          <configuration>
            <quiet>true</quiet>
            <failOnError>false</failOnError>
            <!-- force links to Java 8 documentation (should happen automatically
              but doesn't) -->
            <tags>
              <tag>
                <name>apiNote</name>
                <placement>a</placement>
                <head>API Note:</head>
              </tag>
              <tag>
                <name>implSpec</name>
                <placement>a</placement>
                <head>Implementation Requirements:</head>
              </tag>
              <tag>
                <name>implNote</name>
                <placement>a</placement>
                <head>Implementation Note:</head>
              </tag>
            </tags>
          </configuration>
        </plugin>
        <plugin>
          <!-- Swagger Core produces the OpenAPI specification of the REST services from both
               the JAX-RS and the OpenAPI annotations. Its resolve goal is bound to the compile
               phase and forks no compilation: the specification can hence not be produced by the
               site lifecycle alone. -->
          <groupId>io.swagger.core.v3</groupId>
          <artifactId>swagger-maven-plugin-jakarta</artifactId>
          <version>${swagger.version}</version>
          <configuration>
            <!-- the document the scan completes: it carries the info section OpenAPI requires,
                 which this plugin has no parameter to fill in -->
            <openapiFilePath>${project.build.directory}/openapi-base/openapi.yaml</openapiFilePath>
            <outputFileName>openapi</outputFileName>
            <outputPath>${project.build.directory}/openapi</outputPath>
            <!-- both are provided by core-rs, on which any project documenting its REST API
                 depends -->
            <modelConverterClasses>org.silverpeas.core.rs.doc.JaxbAwareModelResolver</modelConverterClasses>
            <filterClass>org.silverpeas.core.rs.doc.CommonResponsesFilter</filterClass>
            <outputFormat>JSONANDYAML</outputFormat>
            <prettyPrint>true</prettyPrint>
            <sortOutput>true</sortOutput>
            <openapi31>true</openapi31>
            <!-- otherwise the operations that aren't annotated carry only a default response -->
            <defaultResponseCode>200</defaultResponseCode>
          </configuration>
          <executions>
            <execution>
              <phase>process-classes</phase>
              <goals>
                <goal>resolve</goal>
              </goals>
            </execution>
          </executions>
          <dependencies>
            <dependency>
              <!-- the scan by reflection loads the classes of the project, some of them
                   referring RESTEasy types that are absent from the classpath of the plugin -->
              <groupId>org.jboss.resteasy</groupId>
              <artifactId>resteasy-core</artifactId>
              <version>6.2.14.Final</version>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-project-info-reports-plugin</artifactId>
          <version>3.4.2</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>3.0.1</version>
          <configuration>
            <keyname>${gpg.keyname}</keyname>
            <passphraseServerId>${gpg.keyname}</passphraseServerId>
          </configuration>
        </plugin>
        <plugin>
          <groupId>com.mycila</groupId>
          <artifactId>license-maven-plugin</artifactId>
          <version>4.1</version>
        </plugin>
        <plugin>
          <groupId>org.silverpeas.maven</groupId>
          <artifactId>silverpeas-ui-compressor-maven-plugin</artifactId>
          <version>2.0.2</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>3.3.0</version>
        </plugin>
        <plugin>
          <groupId>org.wildfly.plugins</groupId>
          <artifactId>wildfly-maven-plugin</artifactId>
          <version>4.0.0.Final</version>
        </plugin>
        <plugin>
          <groupId>io.github.git-commit-id</groupId>
          <artifactId>git-commit-id-maven-plugin</artifactId>
          <version>10.0.0</version>
        </plugin>
        <plugin>
          <groupId>org.jacoco</groupId>
          <artifactId>jacoco-maven-plugin</artifactId>
          <version>0.8.13</version>
        </plugin>
        <plugin>
          <!-- Smart-Doc lives under two groupIds: com.ly.smart-doc stops at 3.1.2 (Sept. 2025)
               whereas the com.github.shalousun line is still released, hence 4.x. Beware that
               com.ly.smart-doc 3.1.1 and 3.1.2 regressed on the JAX-RS template and title every
               endpoint com.ly.doc.model.DocJavaMethod instead of its Javadoc; 4.0.0 does not. -->
          <groupId>com.github.shalousun</groupId>
          <artifactId>smart-doc-maven-plugin</artifactId>
          <version>4.0.0</version>
          <executions>
            <execution>
              <phase>package</phase>
              <goals>
                <goal>html</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <!-- the framework, the title and the output directory are set per module in its
                 own smart-doc.json; a module without that file is simply skipped. -->
            <configFile>${project.basedir}/smart-doc.json</configFile>
            <projectName>${project.name}</projectName>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <configuration>
          <encoding>UTF-8</encoding>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>skipMinify</id>
      <properties>
        <maven.uicompressor.skip>true</maven.uicompressor.skip>
      </properties>
    </profile>
    <profile>
      <id>deployment</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <phase>verify</phase>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
              <execution>
                <id>bundle-source</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>coverage</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <executions>
              <execution>
                <goals>
                  <goal>prepare-agent</goal>
                </goals>
              </execution>
              <execution>
                <id>tests-coverage</id>
                <phase>verify</phase>
                <goals>
                  <goal>report</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>integration-test</id>
      <activation>
        <property>
          <name>context</name>
          <value>ci</value>
        </property>
      </activation>
      <properties>
        <jcr.home>${temp.directory}/jcr</jcr.home>
        <jcr.conf>${jcr.home}/repository.xml</jcr.conf>
        <wildfly.home>${temp.directory}/wildfly-${wildfly.version}</wildfly.home>
      </properties>
      <build>
        <testResources>
          <testResource>
            <directory>src/test/resources</directory>
            <filtering>true</filtering>
            <includes>
              <include>**/*.properties</include>
            </includes>
          </testResource>
          <testResource>
            <directory>src/test/resources</directory>
            <filtering>false</filtering>
            <excludes>
              <exclude>**/*.properties</exclude>
            </excludes>
          </testResource>
          <testResource>
            <directory>src/integration-test/resources</directory>
            <filtering>true</filtering>
            <includes>
              <include>**/*.properties</include>
            </includes>
          </testResource>
          <testResource>
            <directory>src/integration-test/resources</directory>
            <filtering>false</filtering>
            <excludes>
              <exclude>**/*.properties</exclude>
            </excludes>
          </testResource>
        </testResources>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>add-integration-test-sources</id>
                <phase>generate-test-sources</phase>
                <goals>
                  <goal>add-test-source</goal>
                  <goal>add-test-resource</goal>
                </goals>
                <configuration>
                  <sources>
                    <source>src/integration-test/java</source>
                  </sources>
                  <resources>
                    <resource>
                      <directory>src/integration-test/resources</directory>
                    </resource>
                  </resources>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <executions>
              <execution>
                <goals>
                  <goal>integration-test</goal>
                  <goal>verify</goal>
                </goals>
                <configuration>
                  <reuseForks>true</reuseForks>
                  <skipAfterFailureCount>1</skipAfterFailureCount>
                  <includes>
                    <include>**/*IT.java</include>
                    <include>**/*ITSuite.java</include>
                  </includes>
                  <environmentVariables>
                    <JBOSS_HOME>${wildfly.home}</JBOSS_HOME>
                  </environmentVariables>
                  <redirectTestOutputToFile>false</redirectTestOutputToFile>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <skip>${skip.tests}</skip>
              <excludes>
                <exclude>**/*IT.java</exclude>
                <exclude>**/*ITSuite.java</exclude>
              </excludes>
            </configuration>
          </plugin>
        </plugins>
      </build>
      <dependencies>
        <dependency>
          <groupId>org.wildfly.arquillian</groupId>
          <artifactId>wildfly-arquillian-container-remote</artifactId>
          <scope>test</scope>
        </dependency>
      </dependencies>
    </profile>
    <profile>
      <id>license</id>
      <build>
        <plugins>
          <plugin>
            <groupId>com.mycila</groupId>
            <artifactId>license-maven-plugin</artifactId>
            <configuration>
              <header>license/silverpeas-license.txt</header>
              <quiet>true</quiet>
              <excludes>
                <exclude>**/*.properties</exclude>
                <exclude>**/*.txt</exclude>
                <exclude>**/*.sql</exclude>
                <exclude>**/*.inc</exclude>
                <exclude>**/*.js</exclude>
                <exclude>**/*.html</exclude>
                <exclude>**/fckeditor/**/*.*</exclude>
                <exclude>**/com/sun/**/*.java</exclude>
              </excludes>
              <encoding>UTF-8</encoding>
            </configuration>
            <executions>
              <execution>
                <id>header</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>format</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>release-sign-artifacts</id>
      <activation>
        <property>
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <prerequisites>
    <maven>3.9.0</maven>
  </prerequisites>

</project>
