<!--

    Copyright (C) 2009 eXo Platform SAS.
    
    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 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">
   <parent>
      <groupId>org.exoplatform.portal</groupId>
      <artifactId>exo.portal.packaging</artifactId>
      <version>3.1.11-PLF</version>
   </parent>

   <modelVersion>4.0.0</modelVersion>
   <artifactId>exo.portal.packaging.assembly</artifactId>
   <packaging>pom</packaging>
   <name>GateIn Portal Packaging Assemblies</name>
   
   <properties>
     <gatein.working.dir>${basedir}/target</gatein.working.dir><!-- Default value for server installation dir -->
   </properties>
   
   
   <dependencies>

      <dependency>
         <groupId>org.gatein.tools</groupId>
         <artifactId>packager</artifactId>
         <type>zip</type>
         <version>1.0.0-CR02</version>
      </dependency>

      <dependency>
         <groupId>org.exoplatform.kernel</groupId>
         <artifactId>kernel.packaging.module</artifactId>
         <version>${org.exoplatform.kernel.version}</version>
         <type>js</type>
       </dependency>
       <dependency>
         <groupId>org.exoplatform.core</groupId>
         <artifactId>core.packaging.module</artifactId>
         <version>${org.exoplatform.core.version}</version>
         <type>js</type>
       </dependency>
       <dependency>
         <groupId>org.exoplatform.ws</groupId>
         <artifactId>ws.packaging.module</artifactId>
         <version>${org.exoplatform.ws.version}</version>
         <type>js</type>
       </dependency>
       <dependency>
         <groupId>org.exoplatform.jcr</groupId>
         <artifactId>jcr.packaging.module</artifactId>
         <version>${org.exoplatform.jcr.version}</version>
         <type>js</type>
       </dependency>
       <dependency>
         <groupId>org.exoplatform.portal</groupId>
         <artifactId>portal.packaging.module</artifactId>
         <version>3.1.11-PLF</version>
         <type>js</type>
       </dependency> 
       <dependency>
         <groupId>org.exoplatform.portal</groupId>
         <artifactId>portal.packaging.product</artifactId>
         <version>3.1.11-PLF</version>
         <type>js</type>
       </dependency> 
       <dependency>
         <groupId>org.exoplatform.portal</groupId>
         <artifactId>exo.portal.server.jboss.patch-ear</artifactId>
         <version>3.1.11-PLF</version>
       </dependency> 
       
       <!-- Missing packaging dependencies -->
<dependency><groupId>org.gatein.wci</groupId><artifactId>wci-exo</artifactId><version>${org.gatein.wci.version}</version></dependency>
<dependency><groupId>org.gatein.wci</groupId><artifactId>wci-tomcat</artifactId><version>${org.gatein.wci.version}</version></dependency>
<dependency><groupId>commons-pool</groupId><artifactId>commons-pool</artifactId><version>${commons-pool.version}</version></dependency>
<dependency><groupId>org.exoplatform.jcr</groupId><artifactId>exo.jcr.component.webdav</artifactId><version>${org.exoplatform.jcr.version}</version></dependency>
<dependency><groupId>org.exoplatform.jcr</groupId><artifactId>exo.jcr.framework.web</artifactId> <version>${org.exoplatform.jcr.version}</version></dependency>
<dependency><groupId>org.gatein.wsrp</groupId><artifactId>wsrp-producer</artifactId><version>${org.gatein.wsrp.version}</version><type>war</type></dependency><!-- 1.1.1-GA-->
<dependency><groupId>org.exoplatform.jcr</groupId><artifactId>exo.jcr.component.ftp</artifactId><version>${org.exoplatform.jcr.version}</version><type>jar</type></dependency><!-- 1.12.6-GA-SNAPSHOT-->

<dependency><groupId>commons-digester</groupId><artifactId>commons-digester</artifactId><version>${commons-digester.version}</version><type>jar</type></dependency><!-- 1.8.1-->
<dependency><groupId>commons-dbcp</groupId><artifactId>commons-dbcp</artifactId><version>${commons-dbcp.version}</version><type>jar</type></dependency><!-- 1.2.1-->
<dependency><groupId>asm</groupId><artifactId>asm</artifactId><version>${asm.version}</version><type>jar</type></dependency><!-- 1.5.3-->
<dependency><groupId>jcr</groupId><artifactId>jcr</artifactId><version>${jcr.version}</version><type>jar</type></dependency><!-- 1.0-->
<dependency><groupId>org.exoplatform.kernel</groupId><artifactId>exo.kernel.component.remote</artifactId><version>${org.exoplatform.kernel.version}</version><type>jar</type></dependency><!-- 2.2.6-GA-SNAPSHOT-->
<dependency><groupId>stax</groupId><artifactId>stax-api</artifactId><version>${stax.version}</version><type>jar</type></dependency><!-- 1.0-->
<dependency><groupId>html-parser</groupId><artifactId>html-parser</artifactId><version>${html-parser.version}</version><type>jar</type></dependency><!-- 1.6-->
<dependency><groupId>com.sun.xml.bind</groupId><artifactId>jaxb-impl</artifactId><version>${com.sun.xml.bind.version}</version><type>jar</type></dependency><!-- 2.1.7-->
<dependency><groupId>org.jvnet.jaxb2.maven2</groupId><artifactId>maven-jaxb2-plugin</artifactId><version>${org.jaxb2.version}</version><type>jar</type></dependency><!-- 0.1-->
<dependency><groupId>org.gatein.wsrp</groupId><artifactId>wsrp-admin-gui</artifactId><version>${org.gatein.wsrp.version}</version><type>war</type></dependency><!-- 1.1.1-GA-->
<dependency><groupId>commons-httpclient</groupId><artifactId>commons-httpclient</artifactId><version>${commons-httpclient.version}</version><type>jar</type></dependency><!-- 3.1-->
<dependency><groupId>org.gatein.pc</groupId><artifactId>pc-controller</artifactId><version>${org.gatein.pc.version}</version><type>jar</type></dependency><!-- 2.1.1-GA-->

<!-- Tomcat PKG -->
<dependency><groupId>javassist</groupId><artifactId>javassist</artifactId><version>${javassist.version}</version><type>jar</type></dependency><!-- 3.4.GA-->
<dependency><groupId>antlr</groupId><artifactId>antlr</artifactId><version>${antlr.version}</version><type>jar</type></dependency><!-- 2.7.6rc1-->
<dependency><groupId>cglib</groupId><artifactId>cglib</artifactId><version>${cglib.version}</version><type>jar</type></dependency><!-- 2.2-->
<dependency><groupId>org.exoplatform.tool</groupId><artifactId>exo.tool.webunit</artifactId><version>${exo.tool.webunit.version}</version><type>jar</type></dependency><!-- 3.4.GA-->

   </dependencies>

   <build>
      <plugins>
         <!-- needed for exobuild to call maven dependency:get --> 
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.1</version>
            <configuration>
              <repositoryUrl>xxx</repositoryUrl>
            </configuration>
         </plugin>
         <!-- check-out exobuild -->
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
               <execution>
                  <id>unpack-dependencies</id>
                  <phase>generate-resources</phase>
                  <goals>
                     <goal>unpack</goal>
                  </goals>
                  <configuration>
                     <overWriteSnapshots>true</overWriteSnapshots>
                     <artifactItems>
                        <artifactItem>
                             <groupId>org.gatein.tools</groupId>
                             <artifactId>packager</artifactId>
                             <type>zip</type>
                             <outputDirectory>target/packager</outputDirectory>
                        </artifactItem>
                     </artifactItems>
                  </configuration>
               </execution>
			     <execution>
			       <id>copy-dependencies</id>
			       <phase>compile</phase>
			       <goals>
			         <goal>copy-dependencies</goal>
			       </goals>
			       <configuration>
                     <includeTypes>js</includeTypes>
                     <stripVersion>true</stripVersion>
                     <outputDirectory>${project.build.directory}/packager-conf</outputDirectory>
			       </configuration>
			     </execution>
            </executions>
         </plugin>
   <!-- JBoss-EAR packaging - not in a specific profile so hudson will generate the zip and publish it on maven repo -->
   <!-- Ensure your environment is correctly setup -->
       <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <executions>
             <execution>
                <id>jbossas-check-environment-ready</id>
                <goals>
                   <goal>enforce</goal>
                </goals>
                <configuration>
                   <rules>
                      <requireProperty>
                         <property>exo.projects.directory.dependencies</property>
                         <message>"You must define the property exo.projects.directory.dependencies to give the path to the directory where you store your applications servers"</message>
                      </requireProperty>
                      <requireProperty>
                         <property>exo.projects.app.jboss.version</property>
                         <message>"You must define the property exo.projects.app.jboss.version to give the name of the directory where is stored JBossAS"</message>
                      </requireProperty>
                      <requireFilesExist>
                         <files>
                            <file>${exo.projects.directory.dependencies}/${exo.projects.app.jboss.version}/</file>
                         </files>
                         <message>"The following JBossAS directory doesn't exist : ${exo.projects.directory.dependencies}/${{exo.projects.app.jboss.version}"</message>
                      </requireFilesExist>
                   </rules>
                   <fail>true</fail>
                </configuration>
             </execution>
          </executions>
       </plugin>
       <!-- run exo buils -->
       <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>exec-maven-plugin</artifactId>
          <executions>
             <execution>
                <id>jbossas-packaging</id>
                <phase>package</phase>
                <configuration>
                   <executable>java</executable>
                   <workingDirectory>${basedir}</workingDirectory>
                   <arguments>
                      <argument>-Dexo.package.home=${basedir}/target/packager</argument>
                      <argument>-Dexo.current.dir=${basedir}</argument>
                      <argument>-Dexo.base.dir=${exo.projects.directory.base}</argument>
                      <argument>-Dexo.conf.dir=${basedir}/target/packager-conf</argument>
                      <argument>-Dexo.working.dir=${gatein.working.dir}</argument>
                      <!--argument>-Dexo.src.dir=NONE</argument-->
                      <argument>-Dexo.dep.dir=${exo.projects.directory.dependencies}</argument><!-- to get the server ref install -->
                      <argument>-Dexo.m2.repos=file:${settings.localRepository},http://maven2.exoplatform.org/rest/maven2,http://repository.jboss.org/maven2</argument>
                      <argument>-Dclean.server=${exo.projects.app.jboss.version}</argument>
                      <argument>-Dexo.m2.home=${maven.home}</argument>
                      <argument>-Xms128m</argument>
                      <argument>-Xmx512m</argument>
                      <argument>-classpath</argument>
                      <argument>${basedir}/target/packager/lib/js.jar</argument>
                      <argument>org.mozilla.javascript.tools.shell.Main</argument>
                      <argument>${basedir}/target/packager/javascript/eXo/eXo.js</argument>
                      <argument>exobuild</argument>
                      <argument>--product=portal</argument>
                      <argument>--deploy=jbossear</argument>
                   </arguments>
                </configuration>
                <goals>
                   <goal>exec</goal>
                </goals>
             </execution>
          </executions>
       </plugin>

       <plugin>
          <artifactId>maven-assembly-plugin</artifactId>
          <executions>
             <execution>
                <id>jboss-ear-assembly</id>
                <phase>package</phase>
                <goals>
                   <goal>single</goal>
                </goals>
                <configuration>
                   <descriptors>
                      <descriptor>src/main/assembly/gatein-ear.xml</descriptor>
                   </descriptors>
                   <attach>true</attach>
                </configuration>
             </execution>
          </executions>
       </plugin>
    <!-- End of JBoss-EAR packaging -->

     </plugins>
   </build>

   <profiles>
      <profile>
         <id>pkg-tomcat</id>
         <build>
            <finalName>GateIn-${project.version}</finalName>
            <plugins>
               <!-- Ensure your environment is correctly setup -->
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-enforcer-plugin</artifactId>
                  <executions>
                     <execution>
                        <id>tomcat-check-environment-ready</id>
                        <goals>
                           <goal>enforce</goal>
                        </goals>
                        <configuration>
                           <rules>
                              <requireProperty>
                                 <property>exo.projects.directory.dependencies</property>
                                 <message>"You must define the property exo.projects.directory.dependencies to give the path to the directory where you store your applications servers"</message>
                              </requireProperty>
                              <requireProperty>
                                 <property>exo.projects.app.tomcat.version</property>
                                 <message>"You must define the property exo.projects.app.tomcat.version to give the name of the directory where is stored tomcat"</message>
                              </requireProperty>
                              <requireFilesExist>
                                 <files>
                                    <file>${exo.projects.directory.dependencies}/${exo.projects.app.tomcat.version}/</file>
                                 </files>
                                 <message>"The following Tomcat directory doesn't exist : ${exo.projects.directory.dependencies}/${exo.projects.app.tomcat.version}"</message>
                              </requireFilesExist>
                           </rules>
                           <fail>true</fail>
                        </configuration>
                     </execution>
                  </executions>
               </plugin>
               <!-- run exo build -->
               <plugin>
                  <groupId>org.codehaus.mojo</groupId>
                  <artifactId>exec-maven-plugin</artifactId>
                  <executions>
                     <execution>
                        <id>tomcat-packaging</id>
                        <phase>package</phase>
                        <configuration>
                           <executable>java</executable>
                           <workingDirectory>${basedir}</workingDirectory>
                           <arguments>
                              <argument>-Dexo.package.home=${basedir}/target/packager</argument>
                              <argument>-Dexo.current.dir=${basedir}</argument>
                              <argument>-Dexo.base.dir=${exo.projects.directory.base}</argument>
                              <argument>-Dexo.conf.dir=${basedir}/target/packager-conf</argument>
                              <argument>-Dexo.working.dir=${gatein.working.dir}/</argument>
                              <!--argument>-Dexo.src.dir=NONE</argument-->
                              <argument>-Dexo.dep.dir=${exo.projects.directory.dependencies}</argument><!-- to get the server ref install -->
                              <argument>-Dexo.m2.repos=file:${settings.localRepository},http://maven2.exoplatform.org/rest/maven2,http://repository.jboss.org/maven2</argument>
                              <argument>-Dclean.server=${exo.projects.app.tomcat.version}</argument>
                              <argument>-Dexo.m2.home=${maven.home}</argument>
                              <argument>-Xms128m</argument>
                              <argument>-Xmx512m</argument>
                              <argument>-classpath</argument>
                              <argument>${basedir}/target/packager/lib/js.jar</argument>
                              <argument>org.mozilla.javascript.tools.shell.Main</argument>
                              <argument>${basedir}/target/packager/javascript/eXo/eXo.js</argument>
                              <argument>exobuild</argument>
                              <argument>--product=portal</argument>
                              <argument>--deploy=tomcat</argument>
                           </arguments>
                        </configuration>
                        <goals>
                           <goal>exec</goal>
                        </goals>
                     </execution>
                  </executions>
               </plugin>
            </plugins>
         </build>
      </profile>

      <profile>
         <id>tomcatZip-creation</id>
         <activation>
           <property>
             <name>createTomcatZip</name>
           </property>
         </activation>
         <build>
           <plugins>
             <plugin>
               <artifactId>maven-assembly-plugin</artifactId>
                 <executions>
                   <execution>
                     <id>tomcat-assembly</id>
                     <phase>package</phase>
                     <goals>
                       <goal>single</goal>
                     </goals>
                     <configuration>
                       <descriptors>
                         <descriptor>src/main/assembly/tomcat-zip.xml</descriptor>
                       </descriptors>
                     </configuration>
                   </execution>
                 </executions>
             </plugin>
           </plugins>
         </build>
      </profile>

      <profile>
         <id>pkg-jbossas</id>
         <build>
            <finalName>GateIn-${project.version}</finalName>
            <plugins>
               <!-- Ensure your environment is correctly setup -->
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-enforcer-plugin</artifactId>
                  <executions>
                     <execution>
                        <id>jbossas-check-environment-ready</id>
                        <goals>
                           <goal>enforce</goal>
                        </goals>
                        <configuration>
                           <rules>
                              <requireProperty>
                                 <property>exo.projects.directory.dependencies</property>
                                 <message>"You must define the property exo.projects.directory.dependencies to give the path to the directory where you store your applications servers"</message>
                              </requireProperty>
                              <requireProperty>
                                 <property>exo.projects.app.jboss.version</property>
                                 <message>"You must define the property exo.projects.app.jboss.version to give the name of the directory where is stored JBossAS"</message>
                              </requireProperty>
                              <requireFilesExist>
                                 <files>
                                    <file>${exo.projects.directory.dependencies}/${exo.projects.app.jboss.version}/</file>
                                 </files>
                                 <message>"The following JBossAS directory doesn't exist : ${exo.projects.directory.dependencies}/${{exo.projects.app.jboss.version}"</message>
                              </requireFilesExist>
                           </rules>
                           <fail>true</fail>
                        </configuration>
                     </execution>
                  </executions>
               </plugin>
               <!-- run exo buils -->
               <plugin>
                  <groupId>org.codehaus.mojo</groupId>
                  <artifactId>exec-maven-plugin</artifactId>
                  <executions>
                     <execution>
                        <id>jbossas-packaging</id>
                        <phase>package</phase>
                        <configuration>
                           <executable>java</executable>
                           <workingDirectory>${basedir}</workingDirectory>
                           <arguments>
                              <argument>-Dexo.package.home=${basedir}/target/packager</argument>
                              <argument>-Dexo.current.dir=${basedir}</argument>
                              <argument>-Dexo.base.dir=${exo.projects.directory.base}</argument>
                              <argument>-Dexo.conf.dir=${basedir}/target/packager-conf</argument>
                              <argument>-Dexo.working.dir=${gatein.working.dir}</argument>
                              <!--argument>-Dexo.src.dir=NONE</argument-->
                              <argument>-Dexo.dep.dir=${exo.projects.directory.dependencies}</argument><!-- to get the server ref install -->
                              <argument>-Dexo.m2.repos=file:${settings.localRepository},http://maven2.exoplatform.org/rest/maven2,http://repository.jboss.org/maven2</argument>
                              <argument>-Dclean.server=${exo.projects.app.jboss.version}</argument>
                              <argument>-Dexo.m2.home=${maven.home}</argument>
                              <argument>-Xms128m</argument>
                              <argument>-Xmx512m</argument>
                              <argument>-classpath</argument>
                              <argument>${basedir}/target/packager/lib/js.jar</argument>
                              <argument>org.mozilla.javascript.tools.shell.Main</argument>
                              <argument>${basedir}/target/packager/javascript/eXo/eXo.js</argument>
                              <argument>exobuild</argument>
                              <argument>--product=portal</argument>
                              <argument>--deploy=jbossear</argument>
                           </arguments>
                        </configuration>
                        <goals>
                           <goal>exec</goal>
                        </goals>
                     </execution>
                  </executions>
               </plugin>
<!--
               <plugin>
                  <artifactId>maven-assembly-plugin</artifactId>
                  <executions>
                     <execution>
                        <id>jbossas-assembly</id>
                        <phase>package</phase>
                        <goals>
                           <goal>single</goal>
                        </goals>
                        <configuration>
                           <descriptors>
                              <descriptor>src/main/assembly/jbossear-zip.xml</descriptor>
                           </descriptors>
                           <attach>false</attach>
                        </configuration>
                     </execution>
                  </executions>
               </plugin>
-->
            </plugins>
         </build>
      </profile>
      <profile>
         <id>pkg-tomcat-tests</id>
         <build>
            <finalName>GateIn-${project.version}</finalName>
            <plugins>
               <!-- Ensure your environment is correctly setup -->
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-enforcer-plugin</artifactId>
                  <executions>
                     <execution>
                        <id>tomcat-check-environment-ready</id>
                        <goals>
                           <goal>enforce</goal>
                        </goals>
                        <configuration>
                           <rules>
                              <requireProperty>
                                 <property>exo.projects.directory.dependencies</property>
                                 <message>"You must define the property exo.projects.directory.dependencies to give the path to the directory where you store your applications servers"</message>
                              </requireProperty>
                              <requireProperty>
                                 <property>exo.projects.app.tomcat.version</property>
                                 <message>"You must define the property exo.projects.app.tomcat.version to give the name of the directory where is stored tomcat"</message>
                              </requireProperty>
                              <requireFilesExist>
                                 <files>
                                    <file>${exo.projects.directory.dependencies}/${exo.projects.app.tomcat.version}/</file>
                                 </files>
                                 <message>"The following Tomcat directory doesn't exist : ${exo.projects.directory.dependencies}/${exo.projects.app.tomcat.version}"</message>
                              </requireFilesExist>
                           </rules>
                           <fail>true</fail>
                        </configuration>
                     </execution>
                  </executions>
               </plugin>
               <!-- run exo build -->
               <plugin>
                  <groupId>org.codehaus.mojo</groupId>
                  <artifactId>exec-maven-plugin</artifactId>
                  <executions>
                     <execution>
                        <id>tomcat-packaging</id>
                        <phase>package</phase>
                        <configuration>
                           <executable>java</executable>
                           <workingDirectory>${basedir}</workingDirectory>
                           <arguments>
                              <argument>-Dexo.package.home=${basedir}/target/packager</argument>
                              <argument>-Dexo.current.dir=${basedir}</argument>
                              <argument>-Dexo.base.dir=${exo.projects.directory.base}</argument>
                              <argument>-Dexo.conf.dir=${basedir}/target/packager-conf</argument>
                              <argument>-Dexo.working.dir=${gatein.working.dir}/</argument>
                              <!--argument>-Dexo.src.dir=NONE</argument-->
                              <argument>-Dexo.dep.dir=${exo.projects.directory.dependencies}</argument><!-- to get the server ref install -->
                              <argument>-Dexo.m2.repos=file:${settings.localRepository},http://maven2.exoplatform.org/rest/maven2,http://repository.jboss.org/maven2</argument>
                              <argument>-Dclean.server=${exo.projects.app.tomcat.version}</argument>
                              <argument>-Dexo.m2.home=${maven.home}</argument>
                              <argument>-Xms128m</argument>
                              <argument>-Xmx512m</argument>
                              <argument>-classpath</argument>
                              <argument>${basedir}/target/packager/lib/js.jar</argument>
                              <argument>org.mozilla.javascript.tools.shell.Main</argument>
                              <argument>${basedir}/target/packager/javascript/eXo/eXo.js</argument>
                              <argument>exobuild</argument>
                              <argument>--product=portal</argument>
                              <argument>--deploy=tomcat</argument>
                              <argument>--integration-test</argument>
                           </arguments>
                        </configuration>
                        <goals>
                           <goal>exec</goal>
                        </goals>
                     </execution>
                  </executions>
               </plugin>
<!--
               <plugin>
                  <artifactId>maven-assembly-plugin</artifactId>
                  <executions>
                     <execution>
                        <id>tomcat-assembly</id>
                        <phase>package</phase>
                        <goals>
                           <goal>single</goal>
                        </goals>
                        <configuration>
                           <descriptors>
                              <descriptor>src/main/assembly/tomcat-zip.xml</descriptor>
                           </descriptors>
                           <attach>false</attach>
                        </configuration>
                     </execution>
                  </executions>
               </plugin>
-->
            </plugins>
         </build>

      </profile>
      <profile>
         <id>pkg-jbossas-tests</id>
         <build>
            <finalName>GateIn-${project.version}</finalName>
            <plugins>
               <!-- Ensure your environment is correctly setup -->
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-enforcer-plugin</artifactId>
                  <executions>
                     <execution>
                        <id>jbossas-check-environment-ready</id>
                        <goals>
                           <goal>enforce</goal>
                        </goals>
                        <configuration>
                           <rules>
                              <requireProperty>
                                 <property>exo.projects.directory.dependencies</property>
                                 <message>"You must define the property exo.projects.directory.dependencies to give the path to the directory where you store your applications servers"</message>
                              </requireProperty>
                              <requireProperty>
                                 <property>exo.projects.app.jboss.version</property>
                                 <message>"You must define the property exo.projects.app.jboss.version to give the name of the directory where is stored JBossAS"</message>
                              </requireProperty>
                              <requireFilesExist>
                                 <files>
                                    <file>${exo.projects.directory.dependencies}/${exo.projects.app.jboss.version}/</file>
                                 </files>
                                 <message>"The following JBossAS directory doesn't exist : ${exo.projects.directory.dependencies}/${exo.projects.app.tomcat.version}"</message>
                              </requireFilesExist>
                           </rules>
                           <fail>true</fail>
                        </configuration>
                     </execution>
                  </executions>
               </plugin>
               <!-- run exo buils -->
               <plugin>
                  <groupId>org.codehaus.mojo</groupId>
                  <artifactId>exec-maven-plugin</artifactId>
                  <executions>
                     <execution>
                        <id>jbossas-packaging</id>
                        <phase>package</phase>
                        <configuration>
                           <executable>java</executable>
                           <workingDirectory>${basedir}</workingDirectory>
                           <arguments>
                              <argument>-Dexo.package.home=${basedir}/target/packager</argument>
                              <argument>-Dexo.current.dir=${basedir}</argument>
                              <argument>-Dexo.base.dir=${exo.projects.directory.base}</argument>
                              <argument>-Dexo.conf.dir=${basedir}/target/packager-conf</argument>
                              <argument>-Dexo.working.dir=${gatein.working.dir}</argument>
                              <!--argument>-Dexo.src.dir=NONE</argument-->
                              <argument>-Dexo.dep.dir=${exo.projects.directory.dependencies}</argument><!-- to get the server ref install -->
                              <argument>-Dexo.m2.repos=file:${settings.localRepository},http://maven2.exoplatform.org/rest/maven2,http://repository.jboss.org/maven2</argument>
                              <argument>-Dclean.server=${exo.projects.app.jboss.version}</argument>
                              <argument>-Dexo.m2.home=${maven.home}</argument>
                              <argument>-Xms128m</argument>
                              <argument>-Xmx512m</argument>
                              <argument>-classpath</argument>
                              <argument>${basedir}/target/packager/lib/js.jar</argument>
                              <argument>org.mozilla.javascript.tools.shell.Main</argument>
                              <argument>${basedir}/target/packager/javascript/eXo/eXo.js</argument>
                              <argument>exobuild</argument>
                              <argument>--product=portal</argument>
                              <argument>--deploy=jbossear</argument>
                              <argument>--integration-test</argument>
                           </arguments>
                        </configuration>
                        <goals>
                           <goal>exec</goal>
                        </goals>
                     </execution>
                  </executions>
               </plugin>
<!--
               <plugin>
                  <artifactId>maven-assembly-plugin</artifactId>
                  <executions>
                     <execution>
                        <id>jbossas-assembly</id>
                        <phase>package</phase>
                        <goals>
                           <goal>single</goal>
                        </goals>
                        <configuration>
                           <descriptors>
                              <descriptor>src/main/assembly/jbossear-zip.xml</descriptor>
                           </descriptors>
                           <attach>false</attach>
                        </configuration>
                     </execution>
                  </executions>
               </plugin>
-->
            </plugins>
         </build>
      </profile>
   </profiles>
</project>
