<?xml version="1.0" encoding="UTF-8"?>
<!--
 Copyright 2012 Bull S.A.S.
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->
<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>org.ow2</groupId>
  <artifactId>maven-source-assemblies</artifactId>
  <version>1.0.1</version>

  <name>OW2 :: Maven Source Assemblies</name>

  <description>
    The maven-source-assemblies module packages altogether the
    OW2 customized assembly descriptor(s) that could be used
    when performing project's releases.
  </description>

  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!--  We must redefine the OW2 settings here since this  -->
  <!-- POM cannot depend on OW2's POM (circular reference) -->
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - -->

  <!-- License of this POM -->
  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <!-- Consortium description -->
  <organization>
    <name>OW2 Consortium</name>
    <url>http://www.ow2.org</url>
  </organization>

  <url>http://www.ow2.org</url>

  <!-- Who worked on this project ? -->
  <developers>
    <developer>
      <id>sauthieg</id>
      <name>Guillaume Sauthier</name>
      <email>guillaume.sauthier@ow2.org</email>
    </developer>
  </developers>

  <!-- Source Code Management -->
  <scm>
    <connection>scm:git:git@gitorious.ow2.org:ow2/maven-source-assemblies.git</connection>
    <developerConnection>scm:git:git@gitorious.ow2.org:ow2/maven-source-assemblies.git</developerConnection>
    <url>http://gitorious.ow2.org/ow2/maven-source-assemblies</url>
  </scm>

  <!-- Distribution -->
  <distributionManagement>

    <!-- Site omitted - each project must provide their own -->

    <!-- Release Repository (with staging):
         Refer to this server in your settings.xml using the 'ow2.release' ID -->
    <repository>
      <id>ow2.release</id>
      <name>OW2 Maven Releases Repository</name>
      <url>http://repository.ow2.org/nexus/service/local/staging/deploy/maven2</url>
    </repository>

    <!-- Snapshots Repository:
         Refer to this server in your settings.xml using the 'ow2.snapshot' ID -->
    <snapshotRepository>
      <id>ow2.snapshot</id>
      <name>OW2 Maven Snapshots Repository</name>
      <url>http://repository.ow2.org/nexus/content/repositories/snapshots</url>
    </snapshotRepository>
  </distributionManagement>

  <build>
    <plugins>

      <!-- Enforce Maven version usage: excludes some that are known with defects -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>1.0-beta-1</version>
        <executions>
          <execution>
            <id>enforce-maven</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireMavenVersion>
                  <version>(,2.1.0),(2.1.0,2.2.0),(2.2.0,)</version>
                  <message>Maven 2.1.0 and 2.2.0 produce incorrect GPG signatures and checksums respectively.</message>
                </requireMavenVersion>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>

    <pluginManagement>
      <plugins>
        <!-- Default configuration of the maven-release-plugin:
             * 'release' profile not used
             * use 'ow2-release' profile
           -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.1</version>
          <configuration>
            <mavenExecutorId>forked-path</mavenExecutorId>

            <!-- Do not use the default release profile, use our own instead -->
            <useReleaseProfile>false</useReleaseProfile>
            <!-- Our own release profile -->
            <releaseProfiles>ow2-release</releaseProfiles>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>

  </build>

  <profiles>
    <profile>

      <id>ow2-release</id>
      <build>
        <plugins>
          <!-- - - - - - - - - - - - - - - - - - - - - -->
          <!--  Attach the sources to the project      -->
          <!-- - - - - - - - - - - - - - - - - - - - - -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>2.1.2</version>

            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>

          </plugin>

          <!-- - - - - - - - - - - - - - - - - - - - - -->
          <!--  Sign all the artifacts                 -->
          <!-- - - - - - - - - - - - - - - - - - - - - -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.1</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>

                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <!-- - - - - - - - - - - - - - - - - - - - - -->
          <!--  Generates a source assembly            -->
          <!-- - - - - - - - - - - - - - - - - - - - - -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.3</version>
            <executions>
              <execution>
                <id>source-release-assembly</id>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
                <configuration>
                  <!-- Do not execute that plugin for all modules -->
                  <runOnlyAtExecutionRoot>true</runOnlyAtExecutionRoot>
                  <descriptor>src/main/resources/assemblies/source-release.xml</descriptor>
                  <!-- Use GNU Tar -->
                  <tarLongFileMode>gnu</tarLongFileMode>
                </configuration>
              </execution>
            </executions>
          </plugin>

        </plugins>
      </build>

    </profile>
  </profiles>


</project>