<?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.2.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-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-artifact</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-model</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-settings</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-compat</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.codehaus.plexus</groupId>
          <artifactId>*</artifactId>
        </exclusion>
      </exclusions>
    </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>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-archiver</artifactId>
      <version>3.5.1</version>
    </dependency>
    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-archiver</artifactId>
      <version>4.2.2</version>
    </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>
    <!-- dependencies to annotations -->
    <dependency>
      <groupId>org.apache.maven.plugin-tools</groupId>
      <artifactId>maven-plugin-annotations</artifactId>
      <optional>true</optional>
    </dependency>
   <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-component-annotations</artifactId>
    </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>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>3.8.1</version>
    </dependency>
    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-velocity</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.velocity</groupId>
      <artifactId>velocity</artifactId>
    </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.2</version>
    </dependency>
    
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.easymock</groupId>
      <artifactId>easymock</artifactId>
      <version>3.6</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.rat</groupId>
        <artifactId>apache-rat-plugin</artifactId>
        <configuration>
          <excludes combine.children="append">
            <exclude>src/it/projects/**/.checkstyle</exclude>
            <exclude>src/it/projects/**/.classpath</exclude>
            <exclude>src/it/projects/**/dummy</exclude>
            <exclude>src/it/projects/**/META-INF/MANIFEST.MF</exclude>
            <exclude>src/it/projects/**/*.ogg</exclude>
          </excludes>
        </configuration>
      </plugin>
      <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>
      <properties>
        <maven.it.failure.ignore>false</maven.it.failure.ignore>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>mrm-maven-plugin</artifactId>
            <version>1.3.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>
            <version>3.2.1</version>
            <executions>
              <execution>
                <id>invoker-install</id>
                <goals>
                  <goal>install</goal>
                </goals>
              </execution>
              <execution>
                <id>invoker-it</id>
                <goals>
                  <goal>integration-test</goal>
                </goals>
                <configuration>
                  <showErrors>true</showErrors>
                  <debug>true</debug>
                  <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>
                  <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>
                  <properties>
                    <maven.compiler.source>${maven.compiler.source}</maven.compiler.source>
                    <maven.compiler.target>${maven.compiler.target}</maven.compiler.target>
                    <!-- e.g. ensure that Java7 picks up TLSv1.2 when connecting with Central -->
                    <https.protocols>${https.protocols}</https.protocols>
                  </properties>
                </configuration>
              </execution>
              <execution>
                <id>invoker-verify</id>
                <goals>
                  <goal>verify</goal>
                </goals>
                <configuration>
                  <ignoreFailures>${maven.it.failure.ignore}</ignoreFailures>
                </configuration>
              </execution>
            </executions>
            <configuration>
              <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
            </configuration>
          </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.1</version>
            <executions>
              <execution>
                <goals>
                  <goal>check</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
