<?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.platform</groupId>
    <artifactId>xwiki-platform-core</artifactId>
    <version>7.4</version>
  </parent>
  <groupId>org.xwiki.contrib</groupId>
  <artifactId>parent-platform</artifactId>
  <version>7.4-3</version>
  <name>Contrib Extension</name>
  <packaging>pom</packaging>
  <description>Contrib extension which depends on xwiki-platform</description>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <dependencies>
            <dependency>
              <groupId>org.xwiki.commons</groupId>
              <artifactId>xwiki-commons-tool-enforcer-dependencies</artifactId>
              <version>${commons.version}</version>
            </dependency>
          </dependencies>
          <executions>
            <execution>
              <id>enforce-valid-poms</id>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <!-- Workaround regression introduced in XCOMMONS-895. See XCOMMONS-979. -->
                <!-- TODO: use xwiki-commons-tool-enforcer-dependencies 7.4.4 instead when released -->
                <skip>true</skip>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <!-- Automatically close and release project on Nexus -->
      <plugin>
        <groupId>org.sonatype.plugins</groupId>
        <artifactId>nexus-staging-maven-plugin</artifactId>
        <version>1.6.7</version>
        <extensions>true</extensions>
        <configuration>
          <serverId>xwiki-staging</serverId>
          <nexusUrl>http://nexus.xwiki.org/nexus/</nexusUrl>
          <autoReleaseAfterClose>true</autoReleaseAfterClose>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <!-- Verify that all org.xwiki.commons dependencies 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 have a version specified either as:
               - ${rendering.version}
               - a value not starting with $ (we want to allow supporting ranges)
               Also verifies that all org.xwiki.platform dependencies have a version specified either as:
               - ${platform.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>\$\{rendering.version\}|[^$].*</allowedVersionRegex>
                  </versionCheck>
                  <versionCheck>
                    <groupIdPrefix>org.xwiki.platform</groupIdPrefix>
                    <allowedVersionRegex>\$\{platform.version\}|[^$].*</allowedVersionRegex>
                  </versionCheck>
                </validateDependencyVersion>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <!-- Make sure the extension don't ends up with xwiki-commons url-->
  <url/>

  <!-- Make sure the extension don't ends up with xwiki-commons scm -->
  <scm>
    <connection/>
    <developerConnection/>
    <url/>
  </scm>

  <!-- Make sure the extension don't ends up with xwiki-commons developers -->
  <developers>
    <developer/>
  </developers>
  
  <!-- Make sure the extension don't ends up with xwiki-commons issueManagement -->
  <issueManagement>
    <system/>
    <url/>
  </issueManagement>

  <!-- Set a more accurate organization -->
  <organization>
    <name>XWiki Contrib</name>
    <url>http://contrib.xwiki.org/</url>
  </organization>

  <!-- Standard Maven plugin for contrib extensions -->
  <distributionManagement>
    <repository>
      <id>xwiki-staging</id>
      <name>XWiki Staging Repository</name>
      <url>http://nexus.xwiki.org/nexus/service/local/staging/deploy/maven2/</url>
    </repository>
  </distributionManagement>
</project>
