<?xml version="1.0" encoding="UTF-8"?>
<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>
    <artifactId>maven</artifactId>
    <groupId>org.apache.maven</groupId>
    <version>2.1.0-M1</version>
  </parent>

  <artifactId>apache-maven</artifactId>
  <name>Maven Distribution</name>

  <pluginRepositories>
    <pluginRepository>
      <id>apache.snapshots</id>
      <url>http://people.apache.org/repo/m2-snapshot-repository</url>
      <releases>
        <enabled>false</enabled>
      </releases>
    </pluginRepository>
  </pluginRepositories>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-shade-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <finalName>maven-${project.version}-uber</finalName>
              <createDependencyReducedPom>
                false
              </createDependencyReducedPom>
              <keepDependenciesWithProvidedScope>
                true
              </keepDependenciesWithProvidedScope>
              <transformers>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ComponentsXmlResourceTransformer" />
              </transformers>
              <artifactSet>
                <excludes>
                  <exclude>
                    org.codehaus.plexus:plexus-component-api
                  </exclude>
                  <exclude>classworlds:classworlds</exclude>
                  <exclude>xml-apis:xml-apis</exclude>
                  <exclude>junit:junit</exclude>
                  <exclude>jmock:jmock</exclude>
                </excludes>
              </artifactSet>
              <relocations>
                <!-- for jackrabbit webdav wagon -->
                <relocation>
                  <pattern>org.apache.jackrabbit</pattern>
                </relocation>
                <relocation>
                  <pattern>org.slf4j</pattern>
                </relocation>
                
                <!-- For http/webdav wagons -->
                <relocation>
                  <pattern>org.apache.commons.httpclient</pattern>
                </relocation>
                <relocation>
                  <pattern>org.apache.commons.logging</pattern>
                </relocation>
                <relocation>
                  <pattern>org.apache.commons.codec</pattern>
                </relocation>

                <!-- For jsch wagon -->
                <relocation>
                  <pattern>com.jcraft</pattern>
                </relocation>

                <!-- For wagon API -->
                <relocation>
                  <pattern>org.cyberneko</pattern>
                </relocation>
                <relocation>
                  <pattern>org.apache.xerces</pattern>
                </relocation>

                <relocation>
                  <pattern>org.codehaus.plexus.util</pattern>
                  <excludes>
                    <exclude>org.codehaus.plexus.util.xml.Xpp3Dom</exclude>
                    <exclude>org.codehaus.plexus.util.xml.pull.*</exclude>
                  </excludes>
                </relocation>
              </relocations>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.1</version>
        <!--
        <version>2.2-beta-2</version>
        -->
        <executions>
          <execution>
            <id>bin-assembly</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <descriptor>src/assemble/bin.xml</descriptor>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-toolchain</artifactId>
    </dependency>
 </dependencies>

  <profiles>
    <profile>
      <id>include-site</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-scm-plugin</artifactId>
            <configuration>
              <connectionUrl>scm:svn:http://svn.apache.org/repos/asf/maven/site/trunk</connectionUrl>
              <checkoutDirectory>${project.build.directory}/maven-site</checkoutDirectory>
            </configuration>
            <executions>
              <execution>
                <phase>initialize</phase>
                <goals>
                  <goal>checkout</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-invoker-plugin</artifactId>
            <configuration>
              <projectsDirectory>${project.build.directory}/maven-site</projectsDirectory>
              <pom>${project.build.directory}/maven-site/pom.xml</pom>
              <goals>
                <goal>clean</goal>
                <goal>site</goal>
              </goals>
            </configuration>
            <executions>
              <execution>
                <id>initialize</id>
                <phase>initialize</phase>
                <goals>
                  <goal>run</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
              <execution>
                <id>make-assembly</id>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
                <configuration>
                  <descriptors>
                    <descriptor>src/assemble/src.xml</descriptor>
                  </descriptors>
                  <tarLongFileMode>gnu</tarLongFileMode>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
