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

<!--
  #%L
  License Maven Plugin
  %%
  Copyright (C) 2011-2012 CodeLutin, Codehaus, tony Chzemit
  %%
  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU Lesser General Public License as
  published by the Free Software Foundation, either version 3 of the
  License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Lesser Public License for more details.

  You should have received a copy of the GNU General Lesser Public
  License along with this program.  If not, see
  <http://www.gnu.org/licenses/lgpl-3.0.html>.
  #L%
-->

<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.codehaus.mojo</groupId>
    <artifactId>mojo-parent</artifactId>
    <version>50</version>
  </parent>

  <artifactId>license-maven-plugin</artifactId>
  <version>2.0.0</version>
  <packaging>maven-plugin</packaging>

  <name>License Maven Plugin</name>
  <description>Maven plugin to download and collect license files from project dependencies.</description>
  <url>http://www.mojohaus.org/license-maven-plugin</url>
  <inceptionYear>2010</inceptionYear>
  <licenses>
    <license>
      <name>The GNU Lesser General Public License, Version 3.0</name>
      <url>http://www.gnu.org/licenses/lgpl-3.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <developers>
    <developer>
      <name>Tony Chemit</name>
      <email>dev@tchemit.fr</email>
      <roles>
        <role>Lead Developer</role>
      </roles>
      <organization>Ultreia.io</organization>
      <organizationUrl>https://www.ultreia.io</organizationUrl>
      <timezone>Europe/Paris</timezone>
    </developer>
    <developer>
      <name>Paul Gier</name>
      <email>pgier at redhat</email>
      <roles>
        <role>Developer</role>
      </roles>
    </developer>
  </developers>
  <contributors>
    <contributor>
      <name>Curtis Rueden</name>
    </contributor>
    <contributor>
      <name>Chris Manning</name>
    </contributor>
    <contributor>
      <name>Jérôme Joslet</name>
    </contributor>
    <contributor>
      <name>Benson Margulies</name>
      <email>bimargulies at apache</email>
    </contributor>
    <contributor>
      <name>Cedric Pronzato</name>
    </contributor>
  </contributors>

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

  <scm>
    <connection>scm:git:https://github.com/mojohaus/license-maven-plugin.git</connection>
    <developerConnection>scm:git:ssh://git@github.com/mojohaus/license-maven-plugin.git</developerConnection>
    <url>https://github.com/mojohaus/license-maven-plugin</url>
    <tag>license-maven-plugin-2.0.0</tag>
  </scm>
  <issueManagement>
    <system>github</system>
    <url>https://github.com/mojohaus/license-maven-plugin/issues/</url>
  </issueManagement>
  <ciManagement>
    <system>Travis CI</system>
    <url>https://travis-ci.org/mojohaus/license-maven-plugin</url>
  </ciManagement>
  <distributionManagement>
    <site>
      <id>github</id>
      <url>scm:git:git@github.com:mojohaus/license-maven-plugin.git</url>
    </site>
  </distributionManagement>

  <properties>
    <mavenVersion>3.5.4</mavenVersion>
    <mojo.java.target>1.7</mojo.java.target>

    <processorVersion>1.3</processorVersion>

    <doxiaVersion>1.8</doxiaVersion>
    <!-- ASF project maven-doxia-sitetools:1.8.1 has different release cycle and it is dependent on maven-doxia:1.8 -->
    <doxiaRendererVersion>1.8.1</doxiaRendererVersion>
    <it.debug>true</it.debug>

    <version.httpcomponents.httpclient>4.5.4</version.httpcomponents.httpclient>
    <version.httpcomponents.httpcore>4.4.8</version.httpcomponents.httpcore>

    <!-- license configuration -->
    <license.useMissingFile>true</license.useMissingFile>
    <license.failIfWarning>true</license.failIfWarning>
    <license.licenseName>lgpl_v3</license.licenseName>
    <licensePluginVersion>1.14</licensePluginVersion>

    <pluginPluginVersion>3.5.1</pluginPluginVersion>
    <plexusComponentVersion>1.7.1</plexusComponentVersion>
    <maven-resolver.version>1.3.3</maven-resolver.version>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.apache.maven.plugin-tools</groupId>
        <artifactId>maven-plugin-annotations</artifactId>
        <version>${pluginPluginVersion}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>${version.httpcomponents.httpclient}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpcore</artifactId>
        <version>${version.httpcomponents.httpcore}</version>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.26</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-artifact</artifactId>
      <version>${mavenVersion}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.resolver</groupId>
      <artifactId>maven-resolver-api</artifactId>
      <version>${maven-resolver.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-model</artifactId>
      <version>${mavenVersion}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-core</artifactId>
      <version>${mavenVersion}</version>
      <scope>provided</scope>
      <exclusions>

        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>jcl-over-slf4j</artifactId>
        </exclusion>
        <exclusion>
          <groupId>commons-cli</groupId>
          <artifactId>commons-cli</artifactId>
        </exclusion>

      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.apache.maven.reporting</groupId>
      <artifactId>maven-reporting-api</artifactId>
      <version>3.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.reporting</groupId>
      <artifactId>maven-reporting-impl</artifactId>
      <version>3.0.0</version>
    </dependency>

    <!-- Doxia -->
    <dependency>
      <groupId>org.apache.maven.doxia</groupId>
      <artifactId>doxia-core</artifactId>
      <version>${doxiaVersion}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.doxia</groupId>
      <artifactId>doxia-sink-api</artifactId>
      <version>${doxiaVersion}</version>
    </dependency>

    <!-- Doxia-sitetools -->
    <dependency>
      <groupId>org.apache.maven.doxia</groupId>
      <artifactId>doxia-site-renderer</artifactId>
      <version>${doxiaRendererVersion}</version>
      <exclusions>
        <exclusion>
          <groupId>org.codehaus.plexus</groupId>
          <artifactId>plexus-container-default</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.codehaus.plexus</groupId>
          <artifactId>plexus-component-api</artifactId>
        </exclusion>
        <exclusion>
          <groupId>antlr</groupId>
          <artifactId>antlr</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <!-- dependencies to annotations -->
    <dependency>
      <groupId>org.apache.maven.plugin-tools</groupId>
      <artifactId>maven-plugin-annotations</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-component-annotations</artifactId>
      <version>${plexusComponentVersion}</version>
    </dependency>

    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-utils</artifactId>
      <version>3.1.0</version>
    </dependency>

    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-container-default</artifactId>
      <version>2.0.0</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.nuiton.processor</groupId>
      <artifactId>nuiton-processor</artifactId>
      <version>${processorVersion}</version>
    </dependency>

    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>3.7</version>
    </dependency>

    <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
      <version>1.2</version>
    </dependency>

    <dependency>
      <groupId>commons-collections</groupId>
      <artifactId>commons-collections</artifactId>
      <version>3.2.1</version>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>2.6</version>
    </dependency>

    <dependency>
      <groupId>org.freemarker</groupId>
      <artifactId>freemarker</artifactId>
      <version>2.3.20</version>
    </dependency>

    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpclient</artifactId>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>1.6</version>
          <configuration>
            <!-- Temporary solution to get a release out using gpg version 1 -->
            <useAgent>false</useAgent>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>1.10</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.plexus</groupId>
          <artifactId>plexus-component-metadata</artifactId>
          <version>${plexusComponentVersion}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <configuration>
            <quiet>true</quiet>
            <tagletArtifacts>
              <tagletArtifact>
                <groupId>org.apache.maven.plugin-tools</groupId>
                <artifactId>maven-plugin-tools-javadoc</artifactId>
                <version>${pluginPluginVersion}</version>
              </tagletArtifact>
              <tagletArtifact>
                <groupId>org.codehaus.plexus</groupId>
                <artifactId>plexus-component-javadoc</artifactId>
                <version>${plexusComponentVersion}</version>
              </tagletArtifact>
            </tagletArtifacts>
          </configuration>
        </plugin>
        <plugin>
          <artifactId>maven-plugin-plugin</artifactId>
          <version>${pluginPluginVersion}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-invoker-plugin</artifactId>
          <version>3.0.0</version>
          <configuration>
            <scriptVariables>
              <projectVersion>${project.version}</projectVersion>
            </scriptVariables>
            <environmentVariables>
              <MAVEN_OPTS>-Duser.country=US -Duser.language=en</MAVEN_OPTS>
            </environmentVariables>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.ec4j.maven</groupId>
          <artifactId>editorconfig-maven-plugin</artifactId>
          <version>0.0.10</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.gmaven</groupId>
          <artifactId>groovy-maven-plugin</artifactId>
          <version>2.1</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <executions>
          <execution>
            <id>checkstyle-check</id>
            <goals>
              <goal>check</goal>
            </goals>
            <phase>verify</phase>
          </execution>
        </executions>
        <configuration>
          <headerLocation>config/checkstyle-header.txt</headerLocation>
          <excludes>**/HelpMojo.java,**/SpdxLicenseListData.java</excludes><!-- these are generated -->
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>animal-sniffer-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <signature>
            <groupId>org.codehaus.mojo.signature</groupId>
            <artifactId>java17</artifactId>
            <version>1.0</version>
          </signature>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.plexus</groupId>
        <artifactId>plexus-component-metadata</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>generate-metadata</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-plugin-plugin</artifactId>
        <configuration>
          <goalPrefix>license</goalPrefix>
          <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
        </configuration>
        <executions>
          <execution>
            <id>mojo-descriptor</id>
            <goals>
              <goal>descriptor</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!--
           To test reading third party data from an artifact, we need an artifact.
           In the aggregate case, we can't depend on it in the reactor, since
           there's no way to get any other reactor execution to create it
           in the forked execution of aggregate-add-third-party, not unless
           we want involved in a custom lifecycle. So this barnicle exists
           so that the tests can use it. It's a pity it will end up on Central.
      -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-artifacts</id>
            <phase>package</phase>
            <goals>
              <goal>attach-artifact</goal>
            </goals>
            <configuration>
              <artifacts>
                <artifact>
                  <file>src/license-test/test.license.properties</file>
                  <type>license.properties</type>
                  <classifier>test-third-party</classifier>
                </artifact>
              </artifacts>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.ec4j.maven</groupId>
        <artifactId>editorconfig-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>check</id>
            <phase>validate</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <excludes>
            <exclude>src/main/resources/META-INF/licenses/**</exclude>
            <exclude>src/test/resources/newRepository/**</exclude>
          </excludes>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.gmaven</groupId>
        <artifactId>groovy-maven-plugin</artifactId>
        <executions>
          <execution>
            <!-- Not bound to any phase. Invoke manually using -->
            <!--   mvn groovy:execute@GenerateSpdxLicenseList -->
            <!-- to re-generate SpdxLicenseListData -->
            <id>GenerateSpdxLicenseList</id>
            <goals>
              <goal>execute</goal>
            </goals>
            <configuration>
              <source>${project.basedir}/src/build/scripts/GenerateSpdxLicenseList.groovy</source>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>${version.httpcomponents.httpclient}</version>
          </dependency>
        </dependencies>
      </plugin>

    </plugins>
  </build>

  <profiles>
    <profile>
      <id>run-its</id>
      <activation>
        <property>
          <name>skipITs</name>
          <value>!true</value>
        </property>
      </activation>
      <build>
        <defaultGoal>verify</defaultGoal>
        <plugins>
          <plugin>
            <groupId>org.codehaus.gmaven</groupId>
            <artifactId>groovy-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>LittleProxyStart</id>
                <goals>
                  <goal>execute</goal>
                </goals>
                <phase>pre-integration-test</phase>
                <configuration>
                  <source>${project.basedir}/src/build/scripts/LittleProxyStart.groovy</source>
                </configuration>
              </execution>
              <execution>
                <id>LittleProxyStop</id>
                <goals>
                  <goal>execute</goal>
                </goals>
                <phase>post-integration-test</phase>
                <configuration>
                  <source>System.setProperty('LittleProxy.stop', 'true')</source>
                </configuration>
              </execution>
            </executions>
            <dependencies>
              <dependency>
                <groupId>org.littleshoot</groupId>
                <artifactId>littleproxy</artifactId>
                <version>1.1.2</version>
              </dependency>
            </dependencies>
          </plugin>
          <plugin>
            <artifactId>maven-invoker-plugin</artifactId>
            <configuration>
              <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
              <settingsFile>src/it/settings.xml</settingsFile>
              <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
            </configuration>
            <executions>
              <execution>
                <id>all-integration-test</id>
                <goals>
                  <goal>install</goal>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <skipInvocation />
                  <extraArtifacts>
                    <extraArtifact>${project.groupId}:${project.artifactId}:${project.version}:license.properties:test-third-party</extraArtifact>
                  </extraArtifacts>
                  <pomExcludes>
                    <pomExclude>MLICENSE-4/pom.xml</pomExclude>
                    <pomExclude>download-licenses-proxy/pom.xml</pomExclude>
                  </pomExcludes>
                </configuration>
              </execution>
              <!-- as this it is run in offline, then execute it after the previous its... -->
              <execution>
                <id>integration-test-offline</id>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <pomIncludes>
                    <pomInclude>MLICENSE-4/pom.xml</pomInclude>
                  </pomIncludes>
                  <cloneProjectsTo>${project.build.directory}/it-offline</cloneProjectsTo>
                </configuration>
              </execution>
              <execution>
                <id>integration-test-proxy</id>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <settingsFile>src/it/settings-proxy.xml</settingsFile>
                  <pomIncludes>
                    <pomInclude>download-licenses-proxy/pom.xml</pomInclude>
                  </pomIncludes>
                  <cloneProjectsTo>${project.build.directory}/it-proxy</cloneProjectsTo>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>run-one-it</id>
      <build>
        <defaultGoal>verify</defaultGoal>
        <plugins>
          <plugin>
            <artifactId>maven-invoker-plugin</artifactId>
            <configuration>
              <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
              <settingsFile>src/it/settings.xml</settingsFile>
              <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
            </configuration>
            <executions>
              <execution>
                <id>one-integration-test</id>
                <goals>
                  <goal>install</goal>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <streamLogs>true</streamLogs>
                  <pomIncludes>
                    <pomInclude>${itName}/pom.xml</pomInclude>
                  </pomIncludes>
                </configuration>
              </execution>
            </executions>
            <dependencies>

            </dependencies>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>mojo-release</id>
      <properties>
        <invoker.skip>true</invoker.skip>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>license-maven-plugin</artifactId>
            <version>1.13</version>
            <executions>
              <execution>
                <goals>
                  <goal>add-third-party</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <configuration>
              <additionalparam>-Xdoclint:none</additionalparam>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>reporting</id>
      <activation>
        <property>
          <name>skipReports</name>
          <value>!true</value>
        </property>
      </activation>

      <reporting>
        <plugins>
          <plugin>
            <artifactId>maven-invoker-plugin</artifactId>
            <version>2.0.0</version>
          </plugin>

          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>license-maven-plugin</artifactId>
            <version>1.13</version>
            <reportSets>
              <reportSet>
                <reports>
                  <report>third-party-report</report>
                </reports>
              </reportSet>
            </reportSets>
          </plugin>

        </plugins>
      </reporting>
    </profile>
  </profiles>
</project>
