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

<!-- ~ Copyright 2012 Red Hat, Inc. and/or its affiliates. ~ ~ Licensed under the Eclipse Public License version 1.0, available at ~ http://www.eclipse.org/legal/epl-v10.html -->

<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.jboss.forge</groupId>
      <artifactId>forge-parent</artifactId>
      <version>2.3.0.Final</version>
      <relativePath>../pom.xml</relativePath>
   </parent>

   <artifactId>forge-distribution</artifactId>

   <name>Forge - Distribution Build</name>
   <packaging>pom</packaging>

   <properties>
   </properties>

   <build>
      <plugins>
         <plugin>
            <groupId>org.jboss.forge.furnace</groupId>
            <artifactId>furnace-maven-plugin</artifactId>
            <executions>
               <execution>
                  <id>deploy-addons</id>
                  <phase>prepare-package</phase>
                  <goals>
                     <goal>addon-install</goal>
                  </goals>
                  <inherited>false</inherited>
                  <configuration>
                     <addonRepository>${project.build.directory}/addons</addonRepository>
                     <addonIds>
                        <addonId>org.jboss.forge.addon:core,${project.version}</addonId>
                     </addonIds>
                  </configuration>
               </execution>
            </executions>
         </plugin>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
               <execution>
                  <id>distribution</id>
                  <phase>package</phase>
                  <goals>
                     <goal>single</goal>
                  </goals>
                  <configuration>
                     <appendAssemblyId>false</appendAssemblyId>
                     <descriptors>
                        <descriptor>src/main/assembly/assembly.xml</descriptor>
                     </descriptors>
                     <finalName>${project.build.finalName}</finalName>
                  </configuration>
               </execution>
               <execution>
                  <id>distribution-offline</id>
                  <phase>package</phase>
                  <goals>
                     <goal>single</goal>
                  </goals>
                  <configuration>
                     <descriptors>
                        <descriptor>src/main/assembly/assembly-offline.xml</descriptor>
                     </descriptors>
                  </configuration>
               </execution>
            </executions>
         </plugin>
      </plugins>
   </build>

   <dependencies>

      <!-- Build deps go here -->
      <dependency>
         <groupId>org.jboss.forge</groupId>
         <artifactId>forge-bootstrap</artifactId>
      </dependency>
   </dependencies>

   <profiles>
      <profile>
         <id>release</id>
         <activation>
            <property>
               <name>release</name>
               <value>true</value>
            </property>
         </activation>
         <build>
            <plugins>
               <plugin>
                  <groupId>org.codehaus.mojo</groupId>
                  <artifactId>license-maven-plugin</artifactId>
                  <inherited>false</inherited>
                  <executions>
                     <execution>
                        <goals>
                           <goal>download-licenses</goal>
                        </goals>
                        <phase>package</phase>
                        <configuration>
                           <licensesOutputDirectory>
                              ${project.build.directory}/forge-distribution-${forge.release.version}/docs/licenses
                           </licensesOutputDirectory>
                           <licensesOutputFile>
                              ${project.build.directory}/forge-distribution-${forge.release.version}/docs/licenses/licenses.xml
                           </licensesOutputFile>
                        </configuration>
                     </execution>
                  </executions>
               </plugin>
            </plugins>
         </build>
      </profile>
   </profiles>
</project>
