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

    Copyright (C) 2000 - 2024 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-build260507</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>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>
    <!-- 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-build260507</silverpeas.bom.version>
    <maven.compiler.release>11</maven.compiler.release>
    <wagon.version>3.5.3</wagon.version>
    <wildfly.version>34.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.10.1</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>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.22.2</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>2.22.2</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>
          <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>net.sourceforge.maven-taglib</groupId>
          <artifactId>maven-taglib-plugin</artifactId>
          <version>2.4</version>
        </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>1.7</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>pl.project13.maven</groupId>
          <artifactId>git-commit-id-plugin</artifactId>
          <version>4.9.10</version>
        </plugin>
        <plugin>
          <groupId>org.jacoco</groupId>
          <artifactId>jacoco-maven-plugin</artifactId>
          <version>0.8.8</version>
        </plugin>
        <plugin>
          <groupId>com.qmino</groupId>
          <artifactId>miredot-plugin</artifactId>
          <version>2.4.1-Java11</version>
          <executions>
            <execution>
              <goals>
                <goal>restdoc</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <organizationId>6f45017e-a72e-4de7-91c1-59b3f11b5598</organizationId>
            <restModel>
              <restFramework>
                <name>jax-rs</name>
              </restFramework>
            </restModel>
            <output>
              <html></html>
            </output>
            <!-- insert other configuration here (optional) -->
          </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.yuicompressor.skip>true</maven.yuicompressor.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.6.3</maven>
  </prerequisites>

</project>
