<!--

    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">
   <modelVersion>4.0.0</modelVersion>
   <parent>
      <groupId>org.jboss</groupId>
      <artifactId>jboss-parent</artifactId>
      <version>5-beta-5</version>
   </parent>
   <groupId>org.exoplatform</groupId>
   <artifactId>foundation-parent</artifactId>
   <version>5</version>
   <packaging>pom</packaging>

   <name>eXo JBoss Parent</name>

   <organization>
      <name>eXo Platform SAS</name>
      <url>http://www.exoplatform.com</url>
   </organization>

   <licenses>
      <license>
         <name>LGPL, version 2.1</name>
         <url>http://www.opensource.org/licenses/lgpl-license.php</url>
      </license>
   </licenses>

   <scm>
      <connection>scm:svn:http://anonsvn.jboss.org/repos/exo-jcr/parent/tags/5</connection>
      <developerConnection>scm:svn:https://svn.jboss.org/repos/exo-jcr/parent/tags/5</developerConnection>
      <url>http://fisheye.jboss.org/browse/exo-jcr/parent/tags/5</url>
   </scm>

   <!-- Hudson to parse poms before the build do not use our settings  -->
   <repositories>
      <repository>
         <id>repository.jboss.com</id>
         <url>http://repository.jboss.com/maven2</url>
      </repository>
      <repository>
         <id>exo-int</id>
         <name>exoplatform.org internal repository</name>
         <url>http://maven2.exoplatform.org/rest/maven2</url>
      </repository>
      <repository>
         <id>repo.jfrog.org-releases</id>
         <name>repo.jfrog.org-releases</name>
         <url>http://repo.jfrog.org/artifactory/plugins-releases-local</url>
      </repository>
      <repository>
         <id>download.java.net</id>
         <name>download.java.net repository</name>
         <url>http://download.java.net/maven/2</url>
      </repository>
   </repositories>
   <pluginRepositories>
      <pluginRepository>
         <id>repository.jboss.com</id>
         <url>http://repository.jboss.com/maven2</url>
      </pluginRepository>
      <pluginRepository>
         <id>exo-int</id>
         <name>exoplatform.org internal repository</name>
         <url>http://maven2.exoplatform.org/rest/maven2</url>
      </pluginRepository>
      <pluginRepository>
         <id>repo.jfrog.org-releases</id>
         <name>repo.jfrog.org-releases</name>
         <url>http://repo.jfrog.org/artifactory/plugins-releases-local</url>
      </pluginRepository>
      <pluginRepository>
         <id>download.java.net</id>
         <name>download.java.net repository</name>
         <url>http://download.java.net/maven/2</url>
      </pluginRepository>
      <!-- Used for maven-license-plugin -->
      <pluginRepository>
         <id>mc-release</id>
         <name>Local Maven repository of releases</name>
         <url>http://mc-repo.googlecode.com/svn/maven2/releases</url>
      </pluginRepository>
   </pluginRepositories>

   <properties>
      <exo.projects.directory.base>D:/java</exo.projects.directory.base>
      <exo.projects.directory.dependencies>${exo.projects.directory.base}/exo-dependencies</exo.projects.directory.dependencies>
      <exo.projects.directory.working>${exo.projects.directory.base}/exo-working</exo.projects.directory.working>

      <exo.projects.app.mvn.repo>${exo.projects.directory.dependencies}/repository</exo.projects.app.mvn.repo>

      <exo.projects.app.tomcat.version>tomcat-6.0.16</exo.projects.app.tomcat.version>
      <exo.projects.app.jboss.version>jboss-4.2.3.GA</exo.projects.app.jboss.version>
      <exo.projects.app.jonas.version>JONAS_4_8_5</exo.projects.app.jonas.version>

      <exo.dev.resources.version>1.2.0</exo.dev.resources.version>

      <exo.product.name>eXo Platform</exo.product.name>
      <exo.product.specification>N/A</exo.product.specification>

      <!-- Default tests settings -->
      <maven.test.skip>false</maven.test.skip>
      <forkMode>once</forkMode>
      <maven.test.failure.ignore>false</maven.test.failure.ignore>
      <surefire.useFile>true</surefire.useFile>
      <exo.test.includes>Test*</exo.test.includes>
      <!-- maven-clover2-plugin -->
      <!-- where snapshots are stored to use clover optimization -->
      <maven.clover.snapshot>${user.home}/.clover/${project.groupId}-${project.artifactId}/clover.snapshot</maven.clover.snapshot>
      <!-- where historical data are stored -->
      <maven.clover.historyDir>${user.home}/.clover/${project.groupId}-${project.artifactId}/clover.history</maven.clover.historyDir>
      <!-- Defaut compiler settings -->
      <maven.compiler.optimize>true</maven.compiler.optimize>
      <maven.compiler.source>1.5</maven.compiler.source>
      <maven.compiler.target>1.5</maven.compiler.target>
      <!-- maven-enforcer-plugin -->
      <!-- Java 6 is required to build our projects -->
      <jdk.min.version>1.6</jdk.min.version>
      
      <!-- Encoding used for files in the project -->
      <!-- Standard property supported by many plugins : compiler, resources, ... -->
      <!-- Will be an entry in the POM in the future -->
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

      <!-- maven-release-plugin settings -->
      <arguments>-Prelease -DskipTests</arguments>
      <autoVersionSubmodules>true</autoVersionSubmodules>

      <!-- Plugins versions are defined in properties to reuse them between build and reporting parts if necessary -->
      <version.animalsniffer.plugin>1.2</version.animalsniffer.plugin>
      <version.clover2.plugin>2.6.3</version.clover2.plugin>
      <version.jibx.plugin>1.2.1</version.jibx.plugin>
      <version.javacc.plugin>2.5</version.javacc.plugin>
      <version.jaxb2.plugin>0.1</version.jaxb2.plugin>

   </properties>

   <dependencyManagement>
      <dependencies>
         <!--  Use the same version of JUnit everywhere -->
         <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.2</version>
         </dependency>
      </dependencies>
   </dependencyManagement>

   <build>
      <defaultGoal>install</defaultGoal>
      <pluginManagement>
         <plugins>
            <plugin>
               <groupId>org.jvnet</groupId>
               <artifactId>animal-sniffer</artifactId>
               <version>${version.animalsniffer.plugin}</version>
            </plugin>         
            <plugin>
               <groupId>com.atlassian.maven.plugins</groupId>
               <artifactId>maven-clover2-plugin</artifactId>
               <version>${version.clover2.plugin}</version>
            </plugin>
            <plugin>
               <groupId>org.jibx</groupId>
               <artifactId>maven-jibx-plugin</artifactId>
               <version>${version.jibx.plugin}</version>
            </plugin>
            <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-jar-plugin</artifactId>
               <configuration>
                  <archive>
                     <manifestEntries>
                        <SCM-URL>${project.scm.connection}</SCM-URL>
                        <Specification-Title>${exo.product.name}</Specification-Title>
                        <Specification-Version>${exo.product.specification}</Specification-Version>
                        <Specification-Vendor>${project.organization.name}</Specification-Vendor>
                        <Implementation-Title>${project.name}</Implementation-Title>
                        <Implementation-Version>${project.version}</Implementation-Version>
                        <Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
                     </manifestEntries>
                  </archive>
               </configuration>
            </plugin>
            <plugin>
               <groupId>org.codehaus.mojo</groupId>
               <artifactId>javacc-maven-plugin</artifactId>
               <version>${version.javacc.plugin}</version>
            </plugin>
            <plugin>
               <groupId>org.jvnet.jaxb2.maven2</groupId>
               <artifactId>maven-jaxb2-plugin</artifactId>
               <version>${version.jaxb2.plugin}</version>
            </plugin>
            <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-surefire-plugin</artifactId>
               <configuration>
                  <includes>
                     <include>**/${exo.test.includes}.java</include>
                  </includes>
               </configuration>
            </plugin>
            <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-war-plugin</artifactId>
               <configuration>
                  <archive>
                     <manifestEntries>
                        <SCM-URL>${project.scm.connection}</SCM-URL>
                        <Specification-Title>${exo.product.name}</Specification-Title>
                        <Specification-Version>${exo.product.specification}</Specification-Version>
                        <Specification-Vendor>${project.organization.name}</Specification-Vendor>
                        <Implementation-Title>${project.name}</Implementation-Title>
                        <Implementation-Version>${project.version}</Implementation-Version>
                        <Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
                     </manifestEntries>
                  </archive>
               </configuration>
            </plugin>
         </plugins>
      </pluginManagement>
   </build>

   <!-- Override default reports from JBoss to use properties for plugins versions -->
   <reporting>
      <plugins>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-project-info-reports-plugin</artifactId>
            <version>${version.pir.plugin}</version>
         </plugin>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>${version.javadoc.plugin}</version>
            <configuration>
               <aggregate>true</aggregate>
               <reportOutputDirectory>${project.build.directory}/javadoc</reportOutputDirectory>
               <maxmemory>512m</maxmemory>
               <minmemory>256m</minmemory>
            </configuration>
         </plugin>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-report-plugin</artifactId>
            <version>${version.surefire.plugin}</version>
         </plugin>
         <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>taglist-maven-plugin</artifactId>
            <version>${version.taglist.plugin}</version>
         </plugin>
      </plugins>
   </reporting>

   <profiles>
      <profile>
         <id>checkstyle</id>
         <build>
            <plugins>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-checkstyle-plugin</artifactId>
                  <version>${version.checkstyle.plugin}</version>
                  <dependencies>
                     <dependency>
                        <groupId>org.exoplatform.tool</groupId>
                        <artifactId>dev-resources</artifactId>
                        <version>${exo.dev.resources.version}</version>
                     </dependency>
                  </dependencies>
                  <executions>
                     <execution>
                        <phase>verify</phase>
                        <goals>
                           <goal>check</goal>
                        </goals>
                     </execution>
                  </executions>
               </plugin>
            </plugins>
         </build>
         <reporting>
            <plugins>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-checkstyle-plugin</artifactId>
                  <version>${version.checkstyle.plugin}</version>
                  <configuration>
                     <violationSeverity>warning</violationSeverity>
                     <configLocation>checkstyle/codestyle.xml</configLocation>
                     <headerLocation>checkstyle/java.header</headerLocation>
                  </configuration>
               </plugin>
            </plugins>
         </reporting>
      </profile>
      <profile>
         <id>release</id>
         <build>
            <pluginManagement>
               <plugins>
                  <!-- Manifest management -->
                  <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-war-plugin</artifactId>
                     <configuration>
                        <archive>
                           <manifestEntries>
                              <SCM-Revision>${buildNumber}</SCM-Revision>
                              <SCM-URL>${project.scm.connection}</SCM-URL>
                              <Specification-Title>${exo.product.name}</Specification-Title>
                              <Specification-Version>${exo.product.specification}</Specification-Version>
                              <Specification-Vendor>${project.organization.name}</Specification-Vendor>
                              <Implementation-Title>${project.name}</Implementation-Title>
                              <Implementation-Version>${project.version}</Implementation-Version>
                              <Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
                           </manifestEntries>
                        </archive>
                     </configuration>
                  </plugin>

                  <!-- Manifest management -->
                  <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-jar-plugin</artifactId>
                     <configuration>
                        <archive>
                           <manifestEntries>
                              <SCM-Revision>${buildNumber}</SCM-Revision>
                              <SCM-URL>${project.scm.connection}</SCM-URL>
                              <Specification-Title>${exo.product.name}</Specification-Title>
                              <Specification-Version>${exo.product.specification}</Specification-Version>
                              <Specification-Vendor>${project.organization.name}</Specification-Vendor>
                              <Implementation-Title>${project.name}</Implementation-Title>
                              <Implementation-Version>${project.version}</Implementation-Version>
                              <Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
                           </manifestEntries>
                        </archive>
                     </configuration>
                  </plugin>
               </plugins>
            </pluginManagement>
            <plugins>
               <plugin>
                  <groupId>org.codehaus.mojo</groupId>
                  <artifactId>buildnumber-maven-plugin</artifactId>
                  <executions>
                     <execution>
                        <phase>validate</phase>
                        <goals>
                           <goal>create</goal>
                        </goals>
                     </execution>
                  </executions>
                  <configuration>
                     <doCheck>false</doCheck>
                     <doUpdate>false</doUpdate>
                  </configuration>
               </plugin>
               <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-enforcer-plugin</artifactId>
                 <dependencies>
                     <dependency>
                         <groupId>org.codehaus.mojo</groupId>
                         <artifactId>animal-sniffer-enforcer-rule</artifactId>
                         <version>1.5</version>
                     </dependency>
                 </dependencies>
                 <executions>
                   <execution>
                     <id>check-java15</id>
                     <goals>
                       <goal>enforce</goal>
                     </goals>
                     <configuration>
                       <rules>
                         <checkSignatureRule implementation="org.codehaus.mojo.animal_sniffer.enforcer.CheckSignatureRule">
                           <signature>
                             <groupId>org.codehaus.mojo.signature</groupId>
                             <artifactId>java15</artifactId>
                             <version>1.0</version>
                           </signature>
                           <ignoreDependencies>true</ignoreDependencies>
                         </checkSignatureRule>
                       </rules>
                     </configuration>
                   </execution>
                 </executions>            
               </plugin>
            </plugins>
         </build>
      </profile>
      <profile>
         <id>tomcat-server</id>
         <activation>
            <property>
               <name>tomcat</name>
            </property>
            <activeByDefault>false</activeByDefault>
         </activation>
      </profile>
      <profile>
         <id>jboss-server</id>
         <activation>
            <property>
               <name>jboss-server</name>
            </property>
            <activeByDefault>false</activeByDefault>
         </activation>
      </profile>
      <profile>
         <id>jonas-server</id>
         <activation>
            <property>
               <name>jonas-server</name>
            </property>
            <activeByDefault>false</activeByDefault>
         </activation>
      </profile>
      <profile>
         <id>jmeter-perftest</id>
         <activation>
            <property>
               <name>jmeter-perftest</name>
            </property>
            <activeByDefault>false</activeByDefault>
         </activation>
      </profile>

      <!-- Tests coverage with emma -->
      <profile>
         <id>emma</id>
         <properties>
            <maven.test.failure.ignore>true</maven.test.failure.ignore>
         </properties>
         <build>
            <pluginManagement>
               <plugins>
                  <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-surefire-plugin</artifactId>
                     <configuration>
                        <systemProperties>
                           <property>
                              <name>emma.coverage.out.file</name>
                              <value>target/emma/coverage.ec</value>
                           </property>
                        </systemProperties>
                     </configuration>
                  </plugin>
               </plugins>
            </pluginManagement>
            <plugins>
               <plugin>
                  <artifactId>maven-antrun-plugin</artifactId>
                  <executions>
                     <execution>
                        <id>emma1</id>
                        <phase>test-compile</phase>
                        <configuration>
                           <tasks if="emma.run">
                              <echo message="[EMMA] Start classes instrumentation ..." />
                              <taskdef resource="emma_ant.properties" classpathref="maven.dependency.classpath" />
                              <mkdir dir="target" />
                              <mkdir dir="target/classes" />
                              <mkdir dir="target/emma/classes" />
                              <!-- Do nothing if the directory already exist-->
                              <copy todir="target/emma/classes" verbose="false" overwrite="true">
                                 <fileset dir="target/classes" />
                              </copy>
                              <emma enabled="true">
                                 <instr mode="overwrite" metadatafile="target/emma/metadata.em">
                                    <filter excludes="*.xml.*" />
                                    <filter excludes="*JiBX*" />
                                    <filter excludes="*Entry*" />
                                    <filter excludes="*Value*" />
                                    <filter excludes="*RepositoryServiceConfiguration*" />
                                    <filter excludes="*.query*" />

                                    <instrpath>
                                       <dirset dir="target">
                                          <include name="emma/classes" />
                                       </dirset>
                                    </instrpath>
                                 </instr>
                              </emma>
                           </tasks>
                        </configuration>
                        <goals>
                           <goal>run</goal>
                        </goals>
                     </execution>
                     <execution>
                        <id>emma2</id>
                        <phase>test</phase>
                        <configuration>
                           <tasks if="emma.run">
                              <echo message="[EMMA] Start report generation..." />
                              <taskdef resource="emma_ant.properties" classpathref="maven.dependency.classpath" />
                              <emma enabled="true">
                                 <!-- merged file will be rewritted by last project -->
                                 <merge outfile="target/coverage.es">
                                    <fileset dir=".">
                                       <include name="**/target/emma/*.e*" />
                                       <include name="**/target/emma/*.e*" />
                                    </fileset>
                                 </merge>
                                 <report>
                                    <sourcepath>
                                       <dirset dir=".">
                                          <include name="**/src/**/java" />
                                       </dirset>
                                    </sourcepath>
                                    <fileset dir="target/">
                                       <include name="*.es" />
                                    </fileset>
                                    <html outfile="target/coverage.html" />
                                    <xml outfile="target/coverage.xml" />
                                 </report>
                              </emma>
                           </tasks>
                        </configuration>
                        <goals>
                           <goal>run</goal>
                        </goals>
                     </execution>
                  </executions>
                  <dependencies>
                     <dependency>
                        <groupId>emma</groupId>
                        <artifactId>emma</artifactId>
                        <version>2.0.5312</version>
                     </dependency>
                     <dependency>
                        <groupId>emma</groupId>
                        <artifactId>emma_ant</artifactId>
                        <version>2.0.5312</version>
                     </dependency>
                  </dependencies>
               </plugin>
            </plugins>
         </build>
         <dependencies>
            <dependency>
               <groupId>emma</groupId>
               <artifactId>emma</artifactId>
               <version>2.0.5312</version>
               <scope>test</scope>
            </dependency>
         </dependencies>
      </profile>
   </profiles>
</project>
