<?xml version="1.0" encoding="UTF-8"?>
<!--
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
<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>
  <parent>
    <groupId>org.xwiki.commons</groupId>
    <artifactId>xwiki-commons-pom</artifactId>
    <version>14.2-rc-1</version>
    <!-- Note: Do not modify the <relativePath> tag here as this can cause issues. See the pom.xml for xwiki-platform
         for more details. By using an empty value we force Maven to resolve the parent from the Maven repositories,
         see http://maven.apache.org/ref/3.2.3/maven-model/maven.html#class_parent -->
    <relativePath />
  </parent>
  <groupId>org.xwiki.rendering</groupId>
  <artifactId>xwiki-rendering</artifactId>
  <version>14.2-rc-1</version>
  <name>XWiki Rendering - Parent POM</name>
  <packaging>pom</packaging>
  <description>XWiki Rendering - Parent POM</description>
  <scm>
    <connection>scm:git:git://github.com/xwiki/xwiki-rendering.git</connection>
    <developerConnection>scm:git:git@github.com:xwiki/xwiki-rendering.git</developerConnection>
    <url>https://github.com/xwiki/xwiki-rendering/tree/master/</url>
    <tag>xwiki-rendering-14.2-rc-1</tag>
  </scm>
  <issueManagement>
    <system>jira</system>
    <url>https://jira.xwiki.org/browse/XRENDERING</url>
  </issueManagement>
  <modules>
    <!-- Sorted Alphabetically -->
    <module>xwiki-rendering-api</module>
    <module>xwiki-rendering-archetype-macro</module>
    <module>xwiki-rendering-integration-tests</module>
    <module>xwiki-rendering-macros</module>
    <module>xwiki-rendering-syntaxes</module>
    <module>xwiki-rendering-test</module>
    <module>xwiki-rendering-transformations</module>
    <module>xwiki-rendering-wikimodel</module>
    <module>xwiki-rendering-xml</module>
  </modules>
  <properties>
    <!-- Useful for Rendering extensions -->
    <rendering.version>${commons.version}</rendering.version>
    <!-- By default check that unit tests don't output anything to the console -->
    <xwiki.surefire.captureconsole.skip>false</xwiki.surefire.captureconsole.skip>

    <!-- The recommended version of known extensions to use -->
    <xwiki.extension.recommendedVersions.rendering>
      ${xwiki.extension.recommendedVersions.commons},
      org.xwiki.rendering:.*/[${rendering.version}]
    </xwiki.extension.recommendedVersions.rendering>
    <xwiki.extension.recommendedVersions>${xwiki.extension.recommendedVersions.rendering}</xwiki.extension.recommendedVersions>
  </properties>
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <configuration>
            <archive>
              <!-- Use the manifest file generated by the OSGi Maven Bundle Plugin -->
              <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
            </archive>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <!-- Generate OSGi Manifest information to all JARs -->
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <executions>
          <execution>
            <id>bundle-manifest</id>
            <phase>process-classes</phase>
            <goals>
              <goal>manifest</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <includes>
            <include>**/*Test.java</include>
            <include>**/*RenderingTests.java</include>
            <include>**/*IntegrationTests.java</include>
          </includes>
          <!-- Verify that unit tests don't output anything to stdout/stderr -->
          <systemProperties combine.children="append">
            <!-- This property makes it simple for some module to exclude the check (for example for functional
                 tests) -->
            <property>
              <name>xwiki.surefire.captureconsole.skip</name>
              <value>${xwiki.surefire.captureconsole.skip}</value>
            </property>
          </systemProperties>
          <properties>
            <property>
              <name>listener</name>
              <value>org.xwiki.test.CaptureConsoleRunListener</value>
            </property>
          </properties>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.xwiki.commons</groupId>
            <artifactId>xwiki-commons-tool-test-simple</artifactId>
            <version>${commons.version}</version>
          </dependency>
        </dependencies>
      </plugin>
      <!-- Apply the Checkstyle configurations defined in the top level pom.xml file -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
      </plugin>
      <!-- Check license headers -->
      <plugin>
        <groupId>com.mycila</groupId>
        <artifactId>license-maven-plugin</artifactId>
        <configuration>
          <excludes>
            <!-- Unfortunately we need to copy some excludes from the top level POM since Maven or the License plugin
                 don't merge excludes apparently... -->
            <exclude>**/components.txt</exclude>
            <exclude>**/goal.txt</exclude>
            <exclude>**/it/**/goals.txt</exclude>
            <!-- Exclude Rendering Test Data files -->
            <exclude>**/*.test</exclude>
            <exclude>**/*.in.*txt</exclude>
            <exclude>**/*.out.txt</exclude>
            <exclude>**/*.inout.txt</exclude>
            <exclude>**/*.in.*xml</exclude>
            <exclude>**/*.out.xml</exclude>
            <exclude>**/*.inout.xml</exclude>
            <!-- Exclude Rendering Test framework test data file -->
            <exclude>**/ctstest/type/test/test1.inout.xml</exclude>
            <!-- l10n doesn't put the license header on the generated translation files. -->
            <exclude>**/ApplicationResources_*.properties</exclude>
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <execution>
            <id>enforce-platform-isolation</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <bannedDependencies>
                  <excludes>
                    <!-- Ensure that the XWiki Rendering top level module is independent of the XWiki Platform (so that
                         it can be used standalone) -->
                    <exclude>org.xwiki.platform:*</exclude>
                  </excludes>
                </bannedDependencies>
              </rules>
            </configuration>
          </execution>
          <!-- Verify that all org.xwiki.commons dependencies in Commons have a version specified either as:
               - ${commons.version}
               - a value not starting with $ (we want to allow supporting ranges)
               Also verifies that all org.xwiki.rendering dependencies in Commons have a version specified either as:
               - ${project.version}
               - a value not starting with $ (we want to allow supporting ranges)
          -->
          <execution>
            <id>check-dependency-version</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <validateDependencyVersion implementation="org.xwiki.tool.enforcer.ValidateDependencyVersion">
                  <versionCheck>
                    <groupIdPrefix>org.xwiki.commons</groupIdPrefix>
                    <allowedVersionRegex>\$\{commons.version\}</allowedVersionRegex>
                  </versionCheck>
                  <versionCheck>
                    <groupIdPrefix>org.xwiki.rendering</groupIdPrefix>
                    <allowedVersionRegex>\$\{project.version\}|${rendering.version}</allowedVersionRegex>
                  </versionCheck>
                </validateDependencyVersion>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.revapi</groupId>
        <artifactId>revapi-maven-plugin</artifactId>
        <configuration>
          <analysisConfiguration>
            <revapi.filter>
              <archives>
                <!-- We're ignoring all API incompatibilities from XWiki dependencies (i.e. commons)
                     since they're already covered by their own builds and we release all of them together. -->
                <exclude>
                  <item>org\.xwiki\.commons:.*:.*</item>
                </exclude>
              </archives>
            </revapi.filter>
            <!-- Add ignores here using the following syntax. You can use a single <revapi.differences> entry but it
                 cannot be empty. You can also use different <revapi.differences> entries if you wish to use a common
                 justification for example (see example below).

                 By default criticality is set to "error" if not specified.
                 See https://revapi.org/revapi/configuration.html#_criticality for more.

                 Note: you can use regexes by using the syntax: <regex>true</regex>
                 Don't forget to '\'-escape dots and other special characters in this case ;)

                 Common justification example:

                 <revapi.differences>
                   <justification>This change is necessary to fix bug #1234</justification>
                   <criticality>highlight</criticality>
                   <differences>
                     <item>
                       <code>java.method.addToInterface</code>
                       <fullQualifiedClassName>com.acme.ToolInterface</fullyQualifiedClassName>
                       <new>method void com.acme.ToolInterface::setup()</new>
                     </item>
                     <item>
                       <code>java.method.removed</code>
                       <fullQualifiedClassName>com.acme.ToolInterface</fullyQualifiedClassName>
                       <old>method void com.acme.ToolInterface::initialize()</old>
                       <justification>...</justification>
                     </item>
                   </differences>
                 </revapi.differences>

                 Single justification example:

                 <revapi.differences>
                   <differences>
                     <item>
                       <code>java.method.removed</code>
                       <old>method void org.xwiki.diff.xml.XMLDiff::xxx()</old>
                       <justification>Unstable API added by mistake.</justification>
                       <criticality>highlight</criticality>
                     </item>
                   </differences>
                 </revapi.differences>
            -->
          </analysisConfiguration>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <!-- Profile to build the Standalone module -->
    <profile>
      <id>standalone</id>
      <activation>
        <property>
          <!-- This property is automatically defined by the Maven release plugin when executing
               a release. Thus this profile will be automatically enabled when releasing -->
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>
      <modules>
        <module>xwiki-rendering-standalone</module>
      </modules>
    </profile>
    <!-- Profile to build Legacy modules -->
    <profile>
      <id>legacy</id>
      <modules>
        <module>xwiki-rendering-legacy</module>
      </modules>
    </profile>
    <profile>
      <id>clover</id>
      <properties>
        <!-- Don't check that unit tests don't output anything to the console since for example Clover will output
             messages such as "Updating existing database at '...'." during tests! -->
        <xwiki.surefire.captureconsole.skip>true</xwiki.surefire.captureconsole.skip>
      </properties>
    </profile>
    <profile>
      <!-- To be executed when building snapshots. This allows to not have to have a special settings.xml file
           when building snapshots while not incurring the downside of specifying a maven remote repo for releases,
           see https://blog.sonatype.com/2009/02/why-putting-repositories-in-your-poms-is-a-bad-idea/ -->
      <id>snapshot</id>
      <pluginRepositories>
        <pluginRepository>
          <id>xwiki-snapshots</id>
          <name>XWiki Nexus Plugin Snapshot Repository Proxy</name>
          <url>https://nexus.xwiki.org/nexus/content/groups/public-snapshots</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </pluginRepository>
        <pluginRepository>
          <id>xwiki-releases</id>
          <name>XWiki Nexus Plugin Releases Repository Proxy</name>
          <url>https://nexus.xwiki.org/nexus/content/groups/public</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
      <repositories>
        <repository>
          <id>xwiki-snapshots</id>
          <name>XWiki Nexus Snapshot Repository Proxy</name>
          <url>https://nexus.xwiki.org/nexus/content/groups/public-snapshots</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
        <repository>
          <id>xwiki-releases</id>
          <name>XWiki Nexus Releases Repository Proxy</name>
          <url>https://nexus.xwiki.org/nexus/content/groups/public</url>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
        </repository>
      </repositories>
    </profile>
  </profiles>
</project>
