<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.exoplatform.platform</groupId>
    <artifactId>exo.platform.packaging</artifactId>
    <version>3.0.10</version>
  </parent>
  <artifactId>exo.platform.packaging.jbosseap</artifactId>
  <packaging>pom</packaging>
  <name>eXo Platform - Packaging JBossEAP EARs</name>

<profiles>
    <profile>
      <id>distrib</id>
  <build>
    <finalName>Platform-${project.version}-JBossEAP-EARs</finalName>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <!-- Extract gatein.ear and the jboss server patch -->
          <execution>
             <id>01-ears-unpack-dependencies</id>
             <phase>prepare-package</phase>
             <goals>
               <goal>unpack</goal>
             </goals>
             <configuration>
               <outputDirectory>${project.build.directory}/jboss/server/default/deploy</outputDirectory>
               <artifactItems>
				<artifactItem>
				  <groupId>org.exoplatform.portal</groupId>
				  <artifactId>exo.portal.packaging.assembly</artifactId>
				  <version>${org.exoplatform.portal.version}</version>
                  <classifier>jboss-ear</classifier>
				  <type>zip</type>
				</artifactItem>
				<artifactItem>
				  <groupId>org.exoplatform.platform</groupId>
				  <artifactId>exo.platform.server.jboss.patch</artifactId>
				  <version>${project.version}</version>
				  <type>jar</type>
				  <outputDirectory>${project.build.directory}/jboss</outputDirectory>
                  <excludes>META-INF/</excludes>
				</artifactItem>
                <!-- extracts the docs webapp, PLF-961 -->
				<artifactItem>
				  <groupId>org.exoplatform.platform</groupId>
				  <artifactId>exo.platform.doc.bundle</artifactId>
				  <version>${project.version}</version>
				  <type>war</type>
                  <outputDirectory>${project.build.directory}/jboss/server/default/deploy/docs.war</outputDirectory>
				</artifactItem>
               </artifactItems>
             </configuration>
           </execution>
          <!-- Copy the EARs to jboss/server/default/deploy -->
          <execution>
            <id>02-ears-copy-ears</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>copy</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}/jboss/server/default/deploy</outputDirectory>
              <artifactItems>
				<artifactItem>
				  <groupId>org.exoplatform.portal</groupId>
				  <artifactId>starter-gatein</artifactId>
				  <version>${org.exoplatform.portal.version}</version>
				  <type>ear</type>
				</artifactItem>
				<artifactItem>
				  <groupId>org.exoplatform.cs</groupId>
				  <artifactId>exo.cs.extension.ear</artifactId>
				  <version>${org.exoplatform.cs.version}</version>
				  <type>ear</type>
				</artifactItem>
				<artifactItem>
				  <groupId>org.exoplatform.ecms</groupId>
				  <artifactId>exo-ecms-packaging-wcm-ear</artifactId>
				  <version>${org.exoplatform.ecms.version}</version>
				  <type>ear</type>
				</artifactItem>
				<artifactItem>
				  <groupId>org.exoplatform.ecms</groupId>
				  <artifactId>exo-ecms-packaging-workflow-ear</artifactId>
				  <version>${org.exoplatform.ecms.version}</version>
				  <type>ear</type>
				</artifactItem>
				<artifactItem>
				  <groupId>org.exoplatform.ks</groupId>
				  <artifactId>exo.ks.extension.ear</artifactId>
				  <version>${org.exoplatform.ks.version}</version>
				  <type>ear</type>
				</artifactItem>
				<artifactItem>
				  <groupId>org.exoplatform.platform</groupId>
				  <artifactId>exo.platform.extension.ear</artifactId>
				  <version>${project.version}</version>
				  <type>ear</type>
				</artifactItem>
				<artifactItem>
				  <groupId>org.exoplatform.platform</groupId>
				  <artifactId>exo.platform.sample.acme-website.ear</artifactId>
				  <version>${project.version}</version>
				  <type>ear</type>
				</artifactItem>
				<artifactItem>
				  <groupId>org.exoplatform.platform</groupId>
				  <artifactId>exo.platform.sample.default-website.ear</artifactId>
				  <version>${project.version}</version>
				  <type>ear</type>
				</artifactItem>
				<artifactItem>
				  <groupId>org.exoplatform.platform</groupId>
				  <artifactId>exo.platform.office.ear</artifactId>
				  <version>${project.version}</version>
				  <type>ear</type>
				</artifactItem>
				<artifactItem>
				  <groupId>org.exoplatform.social</groupId>
				  <artifactId>exo.social.extension.ear</artifactId>
				  <version>${org.exoplatform.social.version}</version>
				  <type>ear</type>
				</artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>
       <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
              <execution>
                <id>assembly</id>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
                <configuration>
                  <descriptors>
                    <descriptor>src/main/assembly/ears-archive.xml</descriptor>
                  </descriptors>
                </configuration>
              </execution>
            </executions>
          </plugin>
    </plugins>
  </build>
    </profile>
  </profiles>
</project>
