<?xml version='1.0' encoding='UTF-8'?>
<!--
  ~ JBoss, Home of Professional Open Source.
  ~ Copyright 2010, Red Hat, Inc., and individual contributors
  ~ as indicated by the @author tags. See the copyright.txt file in the
  ~ distribution for a full listing of individual contributors.
  ~
  ~ This 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 2.1 of
  ~ the License, or (at your option) any later version.
  ~
  ~ This software 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
  ~ Lesser General Public License for more details.
  ~
  ~ You should have received a copy of the GNU Lesser General Public
  ~ License along with this software; if not, write to the Free
  ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  -->
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <modelVersion>4.0.0</modelVersion>

    <parent>
      <groupId>org.infinispan.server</groupId>
      <artifactId>infinispan-server-versions</artifactId>
      <version>9.2.2.Final</version>
      <relativePath>../versions/pom.xml</relativePath>
   </parent>

   <artifactId>infinispan-server-licenses</artifactId>
   <packaging>pom</packaging>

   <name>Infinispan Server - Licenses</name>
   <description>Infinispan Server - Licenses</description>


   <dependencies>
       <dependency>
           <groupId>org.infinispan.server</groupId>
           <artifactId>infinispan-server-jgroups</artifactId>
       </dependency>
       <dependency>
           <groupId>org.infinispan.server</groupId>
           <artifactId>infinispan-server-infinispan</artifactId>
       </dependency>
       <dependency>
           <groupId>org.infinispan.server</groupId>
           <artifactId>infinispan-server-endpoints</artifactId>
       </dependency>
       <dependency>
           <groupId>org.wildfly</groupId>
           <artifactId>wildfly-feature-pack</artifactId>
           <type>pom</type>
       </dependency>
   </dependencies>

   <profiles>
      <profile>
         <id>distribution</id>
         <activation>
            <activeByDefault>false</activeByDefault>
         </activation>
         <properties>
            <parent.distribution.dir>${project.basedir}/../../../distribution</parent.distribution.dir>
         </properties>

         <build>
            <plugins>
               <!-- Copy license files from core distribution -->
               <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-resources-plugin</artifactId>
                 <executions>
                    <execution>
                       <id>copy-licenses-xml</id>
                       <phase>prepare-package</phase>
                       <goals>
                          <goal>copy-resources</goal>
                       </goals>
                       <configuration>
                          <outputDirectory>${project.build.directory}/docs/licenses</outputDirectory>
                          <resources>
                             <resource>
                                <directory>${parent.distribution.dir}/src/main/resources/template</directory>
                                <includes>
                                   <include>licenses.xml</include>
                                   <include>licenses.css</include>
                                </includes>
                                <filtering>false</filtering>
                             </resource>
                             <resource>
                                <directory>${parent.distribution.dir}/src/main/resources/licenses</directory>
                                <includes>
                                   <include>*</include>
                                </includes>
                                <filtering>false</filtering>
                             </resource>
                          </resources>
                       </configuration>
                    </execution>
                 </executions>
               </plugin>
               <!-- Collect licenses -->
               <plugin>
                  <groupId>org.wildfly.maven.plugins</groupId>
                  <artifactId>licenses-plugin</artifactId>
                  <version>1.0.0</version>
                  <inherited>false</inherited>
                  <executions>
                     <execution>
                        <id>update-licenses-xml</id>
                        <goals>
                           <goal>insert-versions</goal>
                        </goals>
                        <phase>prepare-package</phase>
                        <configuration>
                           <sortByGroupIdAndArtifactId>true</sortByGroupIdAndArtifactId>
                           <licensesOutputFile>${project.build.directory}/docs/licenses/licenses.xml</licensesOutputFile>
                        </configuration>
                     </execution>
                  </executions>
               </plugin>
               <!-- Generate license file -->
               <!-- Create HTML (parameters: product, version) -->
               <plugin>
                  <groupId>org.codehaus.mojo</groupId>
                  <artifactId>xml-maven-plugin</artifactId>
                  <version>1.0.1</version>
                  <inherited>false</inherited>
                  <executions>
                     <execution>
                        <id>generate-licenses-html</id>
                        <goals>
                           <goal>transform</goal>
                        </goals>
                        <phase>prepare-package</phase>
                        <configuration>
                           <transformationSets>
                              <transformationSet>
                                 <dir>src/main/docs/licenses</dir>
                                 <includes>
                                    <include>licenses.xml</include>
                                 </includes>
                                 <stylesheet>${parent.distribution.dir}/src/main/resources/template/licenses.xsl</stylesheet>
                                 <outputDir>${project.build.directory}/docs/licenses</outputDir>
                                 <fileMappers>
                                    <fileMapper
                                            implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
                                       <targetExtension>.html</targetExtension>
                                    </fileMapper>
                                 </fileMappers>
                                 <parameters>
                                    <parameter>
                                       <name>product</name>
                                       <value>${project.name}</value>
                                    </parameter>
                                    <parameter>
                                       <name>version</name>
                                       <value>${project.version}</value>
                                    </parameter>
                                 </parameters>
                              </transformationSet>
                           </transformationSets>
                        </configuration>
                     </execution>
                  </executions>
               </plugin>
            </plugins>
         </build>
      </profile>
   </profiles>
</project>

