<?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.5.0-Beta3</version>
  </parent>
  <artifactId>exo.platform.packaging.jbossears</artifactId>
  <packaging>pom</packaging>
  <name>eXo Platform - Packaging JBossEAP EARs</name>

  <profiles>
    <profile>
      <id>distrib</id>
	  <dependencies>
		<dependency>
		  <groupId>org.exoplatform.platform</groupId>
		  <artifactId>exo.platform.packaging.commons</artifactId>
		  <version>${project.version}</version>
		  <type>zip</type>
		</dependency>
		<dependency>
		  <groupId>org.exoplatform.platform</groupId>
		  <artifactId>exo.platform.packaging.tomcat</artifactId>
		  <version>${project.version}</version>
		  <classifier>chatserver</classifier>
		  <type>zip</type>
		</dependency>
	  </dependencies>
	  <build>
		<finalName>eXo-Platform-jboss-${project.version}</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>
					<artifactItem>
					  <groupId>org.exoplatform.platform</groupId>
					  <artifactId>exo.platform.packaging.tomcat</artifactId>
					  <version>${project.version}</version>
					  <type>zip</type>
					  <classifier>chatserver</classifier>
					  <outputDirectory>${project.build.directory}/chat-server</outputDirectory>
					</artifactItem>
		            <artifactItem>
		              <groupId>org.exoplatform.platform</groupId>
		              <artifactId>exo.platform.packaging.commons</artifactId>
		              <type>zip</type>
		              <outputDirectory>target/commons</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.gatein.integration</groupId>
					  <artifactId>extension-ear-as5</artifactId>
					  <version>${org.exoplatform.portal.version}</version>
					  <destFileName>gatein-wsrp-extension-${org.exoplatform.portal.version}.ear</destFileName>
					  <type>ear</type>
					</artifactItem>
		            <artifactItem>
					  <groupId>org.exoplatform.webos</groupId>
					  <artifactId>exo.webos.packaging.ear</artifactId>
					  <version>${org.exoplatform.webos.version}</version>
					  <destFileName>exo-webos-extension-${org.exoplatform.webos.version}.ear</destFileName>
					  <type>ear</type>
					</artifactItem>
					<artifactItem>
					  <groupId>org.exoplatform.portal</groupId>
					  <artifactId>starter-gatein</artifactId>
					  <version>${org.exoplatform.portal.version}</version>
					  <destFileName>starter-gatein-${org.exoplatform.portal.version}.ear</destFileName>
					  <type>ear</type>
					</artifactItem>
					<artifactItem>
					  <groupId>org.exoplatform.cs</groupId>
					  <artifactId>exo.cs.extension.ear</artifactId>
					  <version>${org.exoplatform.cs.version}</version>
					  <destFileName>exo-collaboration-extension-${org.exoplatform.cs.version}.ear</destFileName>
					  <type>ear</type>
					</artifactItem>
					<artifactItem>
					  <groupId>org.exoplatform.ecms</groupId>
					  <artifactId>exo-ecms-packaging-wcm-ear</artifactId>
					  <version>${org.exoplatform.ecms.version}</version>
					  <destFileName>exo-wcm-extension-${org.exoplatform.ecms.version}.ear</destFileName>
					  <type>ear</type>
					</artifactItem>
					<artifactItem>
					  <groupId>org.exoplatform.ecms</groupId>
					  <artifactId>exo-ecms-packaging-workflow-ear</artifactId>
					  <version>${org.exoplatform.ecms.version}</version>
					  <destFileName>exo-workflow-extension-${org.exoplatform.ecms.version}.ear</destFileName>
					  <type>ear</type>
					</artifactItem>
					<artifactItem>
					  <groupId>org.exoplatform.ks</groupId>
					  <artifactId>exo.ks.extension.ear</artifactId>
					  <version>${org.exoplatform.ks.version}</version>
					  <destFileName>exo-knowledge-extension-${org.exoplatform.ks.version}.ear</destFileName>
					  <type>ear</type>
					</artifactItem>
					<artifactItem>
					  <groupId>org.exoplatform.platform</groupId>
					  <artifactId>exo.platform.extension.ear</artifactId>
					  <version>${project.version}</version>
					  <destFileName>exo-platform-extension-${project.version}.ear</destFileName>
					  <type>ear</type>
					</artifactItem>
					<artifactItem>
					  <groupId>org.exoplatform.platform</groupId>
					  <artifactId>exo.platform.sample.acme-website.ear</artifactId>
					  <version>${project.version}</version>
					  <destFileName>exo-acme-website-${project.version}.ear</destFileName>
					  <type>ear</type>
					</artifactItem>
					<artifactItem>
					  <groupId>org.exoplatform.platform</groupId>
					  <artifactId>exo.platform.sample.default-website.ear</artifactId>
					  <version>${project.version}</version>
					  <destFileName>exo-default-portal-${project.version}.ear</destFileName>
					  <type>ear</type>
					</artifactItem>
					<artifactItem>
					  <groupId>org.exoplatform.platform</groupId>
					  <artifactId>exo.platform.sample.acme-intranet.ear</artifactId>
					  <version>${project.version}</version>
					  <destFileName>exo-social-intranet-${project.version}.ear</destFileName>
					  <type>ear</type>
					</artifactItem>
					<artifactItem>
					  <groupId>org.exoplatform.social</groupId>
					  <artifactId>exo.social.extension.ear</artifactId>
					  <version>${org.exoplatform.social.version}</version>
					  <destFileName>exo-social-extension-${org.exoplatform.social.version}.ear</destFileName>
					  <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>
		              <appendAssemblyId>false</appendAssemblyId>
		            </configuration>
		          </execution>
		        </executions>
		      </plugin>
		</plugins>
	  </build>
    </profile>
  </profiles>
</project>
