<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (C) 2014 Red Hat, Inc.

    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>

  <parent>
    <groupId>com.redhat.rcm</groupId>
    <artifactId>redhat-releng-tools</artifactId>
    <version>13</version>
  </parent>

  <groupId>org.jboss.pnc</groupId>
  <artifactId>project-sources-maven-plugin</artifactId>
  <version>2.0</version>
  <packaging>maven-plugin</packaging>

  <name>Project Sources Maven Plugin</name>

  <description>Simple plugin to produce a project-sources.tar.gz source archive</description>
  <url>https://github.com/project-ncl/project-sources-maven-plugin</url>
  <inceptionYear>2014</inceptionYear>

  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <developers>
    <developer>
      <id>jdcasey</id>
      <name>John Casey</name>
      <email>jdcasey@commonjava.org</email>
    </developer>
    <developer>
      <id>rnc</id>
      <name>Nick Cross</name>
      <email>ncross@redhat.com</email>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:https://github.com/project-ncl/project-sources-maven-plugin.git</connection>
    <developerConnection>scm:git:git@github.com:project-ncl/project-sources-maven-plugin.git</developerConnection>
    <tag>project-sources-maven-plugin-2.0</tag>
    <url>https://github.com/project-ncl/project-sources-maven-plugin</url>
  </scm>

  <properties>
    <projectOwner>Red Hat, Inc.</projectOwner>
    <javaVersion>1.8</javaVersion>
    <javaTestVersion>${javaVersion}</javaTestVersion>

    <mavenVersion>3.9.12</mavenVersion>
    <it.maven.home>${project.build.directory}/apache-maven-</it.maven.home>
    <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.apache.maven</groupId>
        <artifactId>maven-core</artifactId>
        <version>${mavenVersion}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>org.apache.maven</groupId>
        <artifactId>maven-plugin-api</artifactId>
        <version>${mavenVersion}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>org.apache.maven.plugin-tools</groupId>
        <artifactId>maven-plugin-annotations</artifactId>
        <version>3.15.2</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>3.8.0</version>
      </dependency>
      <!-- Following two override vulnerable dependencies from maven-assembly-plugin -->
      <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.20.0</version>
      </dependency>
      <dependency>
        <groupId>org.codehaus.plexus</groupId>
        <artifactId>plexus-utils</artifactId>
        <version>3.4.2</version>
      </dependency>
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.13.2</version>
        <scope>test</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-assembly-plugin</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.plugin-tools</groupId>
      <artifactId>maven-plugin-annotations</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
    </dependency>
  </dependencies>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>3.9.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-invoker-plugin</artifactId>
          <version>3.9.1</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>com.diffplug.spotless</groupId>
        <artifactId>spotless-maven-plugin</artifactId>
        <version>3.1.0</version>
        <configuration>
          <pom>
            <sortPom>
              <expandEmptyElements>false</expandEmptyElements>
            </sortPom>
          </pom>
          <java>
            <removeUnusedImports/>
            <importOrder>
              <file>java-import-order.txt</file>
            </importOrder>
            <eclipse>
              <file>java-formatter.xml</file>
            </eclipse>
            <lineEndings>UNIX</lineEndings>
          </java>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.jboss.pnc</groupId>
            <artifactId>ide-config</artifactId>
            <version>1.1.0</version>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <goals>
              <goal>apply</goal>
            </goals>
            <phase>compile</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-plugin-plugin</artifactId>
        <version>3.15.2</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <configuration>
          <source>8</source>
          <quiet>true</quiet>
          <detectJavaApiLink>true</detectJavaApiLink>
          <author>false</author>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>run-its</id>
      <build>
        <plugins>
          <plugin>
            <groupId>com.soebes.maven.plugins</groupId>
            <artifactId>iterator-maven-plugin</artifactId>
            <version>0.5.1</version>
            <executions>
              <execution>
                <goals>
                  <goal>iterator</goal>
                </goals>
                <phase>integration-test</phase>
                <configuration>
                  <items>
                    <item>3.3.9</item>
                    <item>3.5.4</item>
                    <item>3.6.3</item>
                    <item>3.8.1</item>
                    <item>3.8.8</item>
                    <item>3.9.1</item>
                    <item>3.9.8</item>
                    <item>3.9.12</item>
                  </items>
                  <pluginExecutors>
                    <pluginExecutor>
                      <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                      </plugin>
                      <goal>unpack</goal>
                      <configuration>
                        <artifactItems>
                          <artifactItem>
                            <groupId>org.apache.maven</groupId>
                            <artifactId>apache-maven</artifactId>
                            <!--suppress UnresolvedMavenProperty -->
                            <version>@item@</version>
                            <type>zip</type>
                            <classifier>bin</classifier>
                            <outputDirectory>${project.build.directory}</outputDirectory>
                          </artifactItem>
                        </artifactItems>
                      </configuration>
                    </pluginExecutor>
                    <pluginExecutor>
                      <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-invoker-plugin</artifactId>
                      </plugin>
                      <goal>install</goal>
                      <configuration>
                        <!--suppress UnresolvedMavenProperty -->
                        <localRepositoryPath>${localRepositoryPath}-@item@</localRepositoryPath>
                      </configuration>
                    </pluginExecutor>
                    <pluginExecutor>
                      <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-invoker-plugin</artifactId>
                      </plugin>
                      <goal>integration-test</goal>
                      <configuration>
                        <properties>
                          <testVersion>${project.version}</testVersion>
                        </properties>
                        <debug>true</debug>
                        <goals>
                          <goal>clean</goal>
                          <goal>package</goal>
                          <goal>install</goal>
                        </goals>
                        <pomIncludes>
                          <!-- <pomInclude>remote-plugin-management-invalid/pom.xml</pomInclude> -->
                          <pomInclude>*/pom.xml</pomInclude>
                        </pomIncludes>
                        <!--suppress UnresolvedMavenProperty -->
                        <localRepositoryPath>${localRepositoryPath}-@item@</localRepositoryPath>
                        <!--suppress UnresolvedMavenProperty -->
                        <cloneProjectsTo>${project.build.directory}/it-one-@item@</cloneProjectsTo>
                        <!--suppress UnresolvedMavenProperty -->
                        <mavenHome>${it.maven.home}@item@</mavenHome>
                        <!-- mavenExecutable>mvnDebug</mavenExecutable -->
                        <postBuildHookScript>verify</postBuildHookScript>
                        <settingsFile>src/it/settings.xml</settingsFile>
                        <addTestClassPath>true</addTestClassPath>
                      </configuration>
                    </pluginExecutor>
                    <pluginExecutor>
                      <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-invoker-plugin</artifactId>
                      </plugin>
                      <goal>verify</goal>
                      <configuration/>
                    </pluginExecutor>
                  </pluginExecutors>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
