<?xml version="1.0" encoding="UTF-8"?>

<!--
  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/xsd/maven-4.0.0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.apache.maven.archetype</groupId>
    <artifactId>maven-archetype</artifactId>
    <version>3.0.1</version>
  </parent>

  <!--
    The purpose of having groupId different from other
    modules is to call mvn archetype:*
    w/out the need to add a plugin group in settings
  -->
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-archetype-plugin</artifactId>
  <packaging>maven-plugin</packaging>

  <name>Maven Archetype Plugin</name>

  <properties>
    <checkstyle.violation.ignore>RedundantThrows,NewlineAtEndOfFile,ParameterNumber,MethodLength,FileLength,javadoc,LineLength</checkstyle.violation.ignore>
  </properties>

  <prerequisites>
    <maven>${mavenVersion}</maven>
  </prerequisites>

  <dependencies>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-compat</artifactId>
      <scope>test</scope>
    </dependency>
  
    <dependency>
      <groupId>org.apache.maven.archetype</groupId>
      <artifactId>archetype-catalog</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.archetype</groupId>
      <artifactId>archetype-descriptor</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.archetype</groupId>
      <artifactId>archetype-common</artifactId>
    </dependency>
    <!-- Required for the integration tests, dependency is only to define build order -->
    <dependency>
      <groupId>org.apache.maven.archetype</groupId>
      <artifactId>archetype-packaging</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-utils</artifactId>
    </dependency>
    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-interactivity-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-model</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-settings</artifactId>
    </dependency>
    <!-- dependencies to annotations -->
    <dependency>
      <groupId>org.apache.maven.plugin-tools</groupId>
      <artifactId>maven-plugin-annotations</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.shared</groupId>
      <artifactId>maven-invoker</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.shared</groupId>
      <artifactId>maven-artifact-transfer</artifactId>
    </dependency>
    <dependency>
      <groupId>easymock</groupId>
      <artifactId>easymock</artifactId>
      <version>1.2_Java1.3</version><!-- with 2.0 compilation failure -->
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>commons-collections</groupId>
      <artifactId>commons-collections</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.shared</groupId>
      <artifactId>maven-script-interpreter</artifactId>
      <version>1.0</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-plugin-plugin</artifactId>
        <executions>
          <execution>
            <id>default-descriptor</id>
            <phase>process-classes</phase>
          </execution>
          <execution>
            <id>generate-helpmojo</id>
            <goals>
              <goal>helpmojo</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-plugin-plugin</artifactId>
        <reportSets>
          <reportSet>
            <reports>
              <report>report</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
    </plugins>
  </reporting>

  <profiles>
    <profile>
      <id>run-its</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>mrm-maven-plugin</artifactId>
            <version>1.1.0</version>
            <executions>
              <execution>
                <id>mirror</id>
                <goals>
                  <goal>start</goal>
                  <goal>stop</goal>
                </goals>
                <configuration>
                  <repositories>
                    <mockRepo>
                      <source>src/it/mrm/repository</source>
                      <cloneTo>target/mock-repo</cloneTo>
                    </mockRepo>
                    <proxyRepo />
                  </repositories>
                </configuration>
              </execution>
              <execution>
                <id>archetype-repository</id>
                <goals>
                  <goal>start</goal>
                  <goal>stop</goal>
                </goals>
                <configuration>
                  <propertyName>archetype-repo.proxy.url</propertyName>
                  <repositories>
                    <mockRepo>
                      <source>src/it/mrm/archetype-repository</source>
                      <cloneTo>target/archetype-repo</cloneTo>
                    </mockRepo>
                  </repositories>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-invoker-plugin</artifactId>
            <configuration>
              <projectsDirectory>src/it/projects</projectsDirectory>
              <cloneClean>true</cloneClean>
              <cloneProjectsTo>${project.build.directory}/it/projects</cloneProjectsTo>
              <pomIncludes>
                <pomInclude>*</pomInclude>
              </pomIncludes>
              <preBuildHookScript>setup</preBuildHookScript>
              <postBuildHookScript>verify</postBuildHookScript>
              <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
              <settingsFile>src/it/mrm/settings.xml</settingsFile>
              <filterProperties>
                <repository.proxy.url>${mrm.repository.url}</repository.proxy.url>
                <archetype-repo.proxy.url>${archetype-repo.proxy.url}</archetype-repo.proxy.url>
              </filterProperties>
            </configuration>
            <executions>
              <execution>
                <id>integration-test</id>
                <goals>
                  <goal>install</goal>
                  <goal>run</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>ciProfile</id>
      <activation>
        <property>
          <name>enableCiProfile</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-docck-plugin</artifactId>
            <version>1.0-beta-2</version>
            <executions>
              <execution>
                <goals>
                  <goal>check</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>maven-2</id>
      <activation>
        <file>
          <!--  This employs that the basedir expression is only recognized by Maven 3.x (see MNG-2363) -->
          <missing>${basedir}</missing>
        </file>
      </activation>
      <build>
        <plugins>
          <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>mojo-descriptor</id>
                <goals><!-- Maven 2 does not support phase overriding: need to add an execution -->
                  <goal>descriptor</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>    
  </profiles>
</project>
