<?xml version="1.0"?>
<!--
  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.rat</groupId>
    <artifactId>apache-rat-project</artifactId>
    <version>0.17</version>
  </parent>
  <artifactId>apache-rat</artifactId>
  <packaging>jar</packaging>
  <name>Apache Creadur RAT::Packaging</name>
  <description>
    This library provides upwards compatibility for projects,
    which are based on Apache RAT versions up to 0.5: Basically, it
    provides a JAR file, which is the combination of
    rat-core, rat-tasks, and its dependencies.
  </description>
  <dependencies>
    <dependency>
      <groupId>org.apache.rat</groupId>
      <artifactId>apache-rat-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.rat</groupId>
      <artifactId>apache-rat-tasks</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.rat</groupId>
      <artifactId>apache-rat-testdata</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <configuration>
          <attach>false</attach>
          <!-- We don't need a source jar of this module -->
          <skipSource>true</skipSource>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-generation-keywords</id>
            <phase>pre-site</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${basedir}/src/site/apt</outputDirectory>
              <overwrite>true</overwrite>
              <resources>
                <resource>
                  <!-- target/classes/org/apache/rat/generation-keywords.txt -->
                  <directory>${project.build.outputDirectory}/org/apache/rat</directory>
                  <includes>
                    <include>generation-keywords.txt</include>
                  </includes>
                </resource>
              </resources>
            </configuration>
          </execution>
          <execution>
            <id>copy-release-notes</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.outputDirectory}/META-INF</outputDirectory>
              <overwrite>true</overwrite>
              <resources>
                <resource>
                  <directory>${project.basedir}/..</directory>
                  <includes>
                    <include>RELEASE_NOTES.txt</include>
                  </includes>
                </resource>
              </resources>
            </configuration>
          </execution>
          <execution>
            <id>copy-example-data</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.testOutputDirectory}/examples</outputDirectory>
              <overwrite>true</overwrite>
              <resources>
                <resource>
                  <directory>../apache-rat-testdata/src/main/resources/examples</directory>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>unpack dependencies</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>unpack-dependencies</goal>
            </goals>
            <configuration>
              <includeScope>runtime</includeScope>
              <outputDirectory>${project.build.outputDirectory}</outputDirectory>
              <overWriteIfNewer>true</overWriteIfNewer>
              <excludes>META-INF/**</excludes>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <excludes>
            <exclude>META-INF/maven</exclude>
          </excludes>
          <archive>
            <manifestEntries>
              <Main-Class>org.apache.rat.Report</Main-Class>
              <Extension-Name>rat</Extension-Name>
              <Specification-Title>Apache Creadur RAT</Specification-Title>
              <Specification-Vendor>apache.org</Specification-Vendor>
              <Specification-Version>${project.version}</Specification-Version>
              <Implementation-Vendor-Id>apache.org</Implementation-Vendor-Id>
              <Implementation-Title>Apache Creadur RAT</Implementation-Title>
              <Implementation-Vendor>Apache Software Foundation</Implementation-Vendor>
              <Implementation-Version>${project.version}</Implementation-Version>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>animal-sniffer-maven-plugin</artifactId>
        <executions>
          <execution>
            <!-- This sub project has no source code, so we need to skip animal sniffer -->
            <id>check-java-1.8-compat</id>
            <configuration>
              <skip>true</skip>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <dependencies>
          <dependency>
            <groupId>org.apache.maven.doxia</groupId>
            <artifactId>doxia-module-markdown</artifactId>
            <version>2.0.0</version>
          </dependency>
          <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>apache-rat-tools</artifactId>
            <version>${project.parent.version}</version>
          </dependency>
          <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>apache-rat-core</artifactId>
            <version>${project.parent.version}</version>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>Initial site generation</id>
            <phase>pre-site</phase>
            <goals>
              <goal>java</goal>
            </goals>
            <configuration>
              <mainClass>org.apache.rat.documentation.Exporter</mainClass>
              <classpathScope>test</classpathScope>
              <arguments>
                <argument>${project.basedir}/src/templates</argument>
                <argument>${project.basedir}/src/site</argument>
              </arguments>
            </configuration>
          </execution>
          <execution>
            <id>Naming help generation</id>
            <phase>pre-site</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <executable>java</executable>
              <outputFile>${project.basedir}/src/site/apt/name_xref.txt</outputFile>
              <arguments>
                <argument>-cp</argument>
                <argument>target/apache-rat-${project.version}.jar</argument>
                <argument>org.apache.rat.tools.Naming</argument>
                <argument>--maven</argument>
                <argument>--ant</argument>
                <argument>--cli</argument>
              </arguments>
            </configuration>
          </execution>
          <execution>
            <id>default_output_generation</id>
            <phase>pre-site</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <executable>java</executable>
              <arguments>
                <argument>-cp</argument>
                <argument>target/apache-rat-${project.version}.jar</argument>
                <argument>org.apache.rat.Report</argument>
                <argument>--counter-max</argument>
                <argument>UNAPPROVED:2</argument>
                <argument>--output-file</argument>
                <argument>${project.basedir}/src/site/examples/default-output.txt</argument>
                <argument>${project.build.testOutputDirectory}/examples/exampleData</argument>
              </arguments>
            </configuration>
          </execution>
          <execution>
            <id>xml_output_generation</id>
            <phase>pre-site</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <executable>java</executable>
              <arguments>
                <argument>-cp</argument>
                <argument>target/apache-rat-${project.version}.jar</argument>
                <argument>org.apache.rat.Report</argument>
                <argument>--counter-max</argument>
                <argument>UNAPPROVED:2</argument>
                <argument>--output-file</argument>
                <argument>${project.basedir}/src/site/examples/rat-report.txt</argument>
                <argument>--output-style</argument>
                <argument>xml</argument>
                <argument>${project.build.testOutputDirectory}/examples/exampleData</argument>
              </arguments>
            </configuration>
          </execution>
          <execution>
            <id>unapproved_licenses_generation</id>
            <phase>pre-site</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <executable>java</executable>
              <arguments>
                <argument>-cp</argument>
                <argument>target/apache-rat-${project.version}.jar</argument>
                <argument>org.apache.rat.Report</argument>
                <argument>--counter-max</argument>
                <argument>UNAPPROVED:2</argument>
                <argument>--output-file</argument>
                <argument>${project.basedir}/src/site/examples/unapproved-licenses.txt</argument>
                <argument>--output-style</argument>
                <argument>unapproved-licenses</argument>
                <argument>${project.build.testOutputDirectory}/examples/exampleData</argument>
              </arguments>
            </configuration>
          </execution>
          <execution>
            <id>XSD generation</id>
            <phase>pre-site</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <executable>java</executable>
              <outputFile>${project.basedir}/target/site/rat.xsd</outputFile>
              <arguments>
                <argument>-cp</argument>
                <argument>target/apache-rat-${project.version}.jar</argument>
                <argument>org.apache.rat.tools.xsd.XsdGenerator</argument>
              </arguments>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <environmentVariables>
            <LANG>en_US</LANG>
          </environmentVariables>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <configuration>
          <filesets>
            <fileset>
              <directory>src/site/apt/</directory>
              <includes>
                <include>*.txt</include>
              </includes>
              <followSymlinks>false</followSymlinks>
            </fileset>
            <fileset>
              <directory>src/site/examples/</directory>
              <includes>
                <include>*.txt</include>
              </includes>
              <followSymlinks>false</followSymlinks>
            </fileset>
          </filesets>
        </configuration>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.rat</groupId>
          <artifactId>apache-rat-plugin</artifactId>
          <configuration>
            <excludes>
              <!-- files that are examples of output from the tool -->
              <exclude>src/site/examples/**</exclude>
              <exclude>src/site/apt/*.txt</exclude>
            </excludes>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.eclipse.m2e</groupId>
          <artifactId>lifecycle-mapping</artifactId>
          <version>1.0.0</version>
          <configuration>
            <lifecycleMappingMetadata>
              <pluginExecutions>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <versionRange>[2.0,)</versionRange>
                    <goals>
                      <goal>unpack-dependencies</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>exec-maven-plugin</artifactId>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
  <profiles>
    <profile>
      <id>apache-release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
              <descriptorSourceDirectory>${basedir}/src/main/assembly/</descriptorSourceDirectory>
              <tarLongFileMode>gnu</tarLongFileMode>
            </configuration>
            <executions>
              <execution>
                <id>make-assembly</id>
                <phase>package</phase>
                <!-- append to the packaging phase. -->
                <goals>
                  <goal>single</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
