<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
 this work for additional information regarding copyright ownership.
 The ASF licenses this file to You 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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-parent</artifactId>
      <version>30</version>
  </parent>
 
  <groupId>org.apache.commons</groupId>
  <artifactId>commons-staging-plugin</artifactId>
  <version>0.1-SNAPSHOT</version>
  <name>Apache Commons Staging Maven Mojo</name>
  <packaging>maven-plugin</packaging>
  <inceptionYear>2013</inceptionYear>
  <url>http://commons.apache.org/proper/commons-staging-plugin/</url>

  <description>
  This Apache Commons plugin for Maven provides goals for staging
  tarballs - source and binary packages for distribution via
  the ASF mirroring system.
  </description>

  <issueManagement>
    <system>jira</system>
    <url>http://issues.apache.org/jira/browse/COMMONSSITE</url>
  </issueManagement>

  <scm>
    <connection>scm:svn:http://svn.apache.org/repos/asf/commons/proper/commons-staging-plugin/trunk/</connection>
    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/commons/proper/commons-staging-plugin/trunk/</developerConnection>
    <url>http://svn.apache.org/viewvc/commons/proper/commons-staging-plugin/trunk/</url>
  </scm>

  <prerequisites>
    <maven>${mavenVersion}</maven>
  </prerequisites>

   <properties>
    <mavenVersion>2.2.1</mavenVersion>
    <mavenPluginPluginVersion>3.2</mavenPluginPluginVersion>
    <maven.compiler.source>1.5</maven.compiler.source>
    <maven.compiler.target>1.5</maven.compiler.target>
    <commons.release.version>0.1</commons.release.version>
    <commons.componentid>commons-gpg-plugin</commons.componentid>
    <commons.rc.version>RC1</commons.rc.version>
    <commons.release.desc>(Requires Maven ${mavenVersion} or later)</commons.release.desc>
    <!-- Avoid problems with jar & osgi builds in CP -->
    <commons.manifestfile />
    <!-- Temporary fix until CP31 is released -->
    <maven.compile.source>${maven.compiler.source}</maven.compile.source>
    <maven.compile.target>${maven.compiler.target}</maven.compile.target>
    <!-- This should move to parent pom -->
    <commons.packages.directory>target/packages</commons.packages.directory>
  </properties>

  <dependencies>
    <dependency>
      <groupId>commons-codec</groupId>
      <artifactId>commons-codec</artifactId>
      <!-- 1.6 only requres Java 1.5 -->
      <version>1.6</version>
    </dependency>

    <!-- Needed by AbstractExecMojo for command execution etc. -->
    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-utils</artifactId>
      <version>3.0.7</version>
    </dependency>
    <!-- needed to fetch login credentials from settings.xml -->
    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-container-default</artifactId>
      <version>1.0-alpha-9</version>
      <scope>provided</scope>
    </dependency>
    <!-- needed to decode login credentials from settings.xml -->
    <dependency>
      <groupId>org.sonatype.plexus</groupId>
      <artifactId>plexus-sec-dispatcher</artifactId>
      <version>1.4</version>
      <scope>provided</scope>
    </dependency>

    <!-- Following dependencies are for building/running Mojos -->

    <!-- for our own help Mojo -->
    <dependency>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-help-plugin</artifactId>
      <version>2.2</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
      <version>${mavenVersion}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-project</artifactId>
      <version>${mavenVersion}</version>
      <exclusions>
        <exclusion>
          <groupId>org.codehaus.plexus</groupId>
          <artifactId>plexus-container-default</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.plugin-tools</groupId>
      <artifactId>maven-plugin-annotations</artifactId>
      <version>${mavenPluginPluginVersion}</version>
      <!-- annotations are not needed for plugin execution so you can remove this dependency
           for execution with using provided scope -->
      <scope>provided</scope>
    </dependency>
  </dependencies>

  <build>

    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-plugin-plugin</artifactId>
          <version>${mavenPluginPluginVersion}</version>
          <configuration>
            <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <descriptors>
            <descriptor>src/main/assembly/bin.xml</descriptor>
            <descriptor>src/main/assembly/src.xml</descriptor>
          </descriptors>
          <tarLongFileMode>gnu</tarLongFileMode>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-plugin-plugin</artifactId>
        <configuration>
          <!-- see http://jira.codehaus.org/browse/MNG-5346 -->
          <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
        </configuration>
        <executions>
          <execution>
            <id>generate-descriptor</id>
            <goals>
              <goal>descriptor</goal>
            </goals>
          </execution>
          <!-- The generated Mojo does not handle annotations properly,
               and does not show any "User property" names.
               Since this is misleading, it is better to drop the goal
               The Maven Help plugin does show property names, so we create
               our own Help Mojo that extends it.
          <execution>
            <id>generated-helpmojo</id>
            <goals>
              <goal>helpmojo</goal>
            </goals>
          </execution>
           -->
        </executions>
      </plugin>
    </plugins>
  </build>
  
  <profiles>
    <!-- 
        Sample profiles to show how the new plugins work and are invoked.
        For live use, these would be merged into the release profile in the parent pom. 
    -->
    <!-- This profile needs to be merged into top-level of pom -->
    <profile>
      <id>define-plugins</id>
      <build>
    <pluginManagement>
      <!-- Define the standard configuration -->
      <plugins>
        <plugin>
          <groupId>org.apache.commons</groupId>
          <artifactId>commons-gpg-plugin</artifactId>
          <version>0.1-SNAPSHOT</version>
        </plugin>
        <plugin>
          <groupId>org.apache.commons</groupId>
          <artifactId>commons-digest-plugin</artifactId>
          <version>0.1-SNAPSHOT</version>
        </plugin>
        <plugin>
          <groupId>org.apache.commons</groupId>
          <artifactId>commons-staging-plugin</artifactId>
          <version>0.1-SNAPSHOT</version>
          <!-- This needs to be configured for the local project; sample below is for Apache Commons -->
          <configuration>
            <packageDirectory>${commons.packages.directory}</packageDirectory>
            <asfProject>commons</asfProject>
            <asfComponent>${commons.componentid}</asfComponent>
            <stagingDirectory>${commons.release.name}-${commons.rc.version}</stagingDirectory>
            <releaseNotes>RELEASE-NOTES.txt</releaseNotes>
            <!-- safe place for upload and release testing -->
            <rootUrl>https://dist.apache.org/repos/dist/dev/commons/TEST_PLS_IGNORE/</rootUrl>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-gpg-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-digest-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-staging-plugin</artifactId>
      </plugin>
    </plugins>
    </build>
    </profile>

    <!-- This will eventually be merged into the parent pom -->
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <!-- We want to create the assemblies in their own directory -->
          <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
              <!-- Stop assemblies from being deployed to Nexus -->
              <attach>false</attach>
              <!-- put them here instead -->
              <outputDirectory>${commons.packages.directory}</outputDirectory>
            </configuration>
          </plugin>
          <!-- Create the signatures -->
          <plugin>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-gpg-plugin</artifactId>
            <executions>
              <execution>
                <goals>
                  <goal>signfiles</goal>
                </goals>
                <!-- must run after assembly and before deploy -->
                <phase>verify</phase>
              </execution>
            </executions>
            <configuration>
              <includes>
                <include>${commons.packages.directory}/*.zip</include>
                <include>${commons.packages.directory}/*.tar.gz</include>
              </includes>
            </configuration>
          </plugin>
          <!-- create the hashes -->
          <plugin>
           <groupId>org.apache.commons</groupId>
            <artifactId>commons-digest-plugin</artifactId>
            <!-- Don't put this config in pluginManagement otherwise CLI use is harder -->
            <configuration>
              <includes>
                <include>${commons.packages.directory}/*.zip</include>
                <include>${commons.packages.directory}/*.tar.gz</include>
              </includes>
            </configuration>
            <executions>
              <execution>
                <goals>
                  <goal>digest</goal>
                </goals>
                <!-- must run after assembly and before deploy -->
                <phase>verify</phase>
              </execution>
            </executions>
          </plugin>
          <!-- Now create the staging scripts-->
        </plugins>
      </build>
    </profile>

  </profiles>
</project>
