<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.rhq</groupId>
      <artifactId>rhq-parent</artifactId>
      <version>4.11.0</version>
      <relativePath>../../../../pom.xml</relativePath>
   </parent>

   <groupId>org.rhq</groupId>
   <artifactId>rhq-portal</artifactId>
   <packaging>war</packaging>

   <name>RHQ Enterprise Portal</name>
   <description>the RHQ Enterprise Portal webapp</description>

   <properties>
      <!-- dependency versions -->
      <jsf-facelets.version>1.1.15.B1</jsf-facelets.version>

      <!-- plugin versions -->
      <jetty-jspc-maven-plugin.version>7.0.1.v20091125</jetty-jspc-maven-plugin.version>

      <!-- Note: The product info properties now live in the RHQ root pom. -->
   </properties>


   <dependencies>

       <!-- Internal Deps -->

      <dependency>
         <groupId>org.rhq</groupId>
         <artifactId>rhq-core-domain</artifactId>
         <version>${project.version}</version>
         <scope>provided</scope> <!-- by rhq.ear (as ejb-jar) -->
      </dependency>

      <dependency>
         <groupId>org.rhq</groupId>
         <artifactId>rhq-core-gui</artifactId>
         <version>${project.version}</version>
      </dependency>

      <dependency>
         <groupId>org.rhq</groupId>
         <artifactId>rhq-enterprise-server</artifactId>
         <version>${project.version}</version>
         <scope>provided</scope> <!-- by rhq.ear (as ejb-jar) -->
      </dependency>

      <dependency>
         <groupId>org.rhq</groupId>
         <artifactId>rhq-core-util</artifactId>
         <version>${project.version}</version>
         <scope>provided</scope> <!-- by rhq.ear -->
      </dependency>

      <!-- 3rd Party Deps -->

      <dependency>
         <groupId>com.sun.facelets</groupId>
         <artifactId>jsf-facelets</artifactId>
         <version>${jsf-facelets.version}</version>
      </dependency>

      <!-- NOTE: Do *not* set this to provided scope. The version that comes with AS 4.2 is not compatible w/ Ajax4JSF. -->
      <dependency>
         <groupId>commons-collections</groupId>
         <artifactId>commons-collections</artifactId>
      </dependency>

      <dependency>
         <groupId>commons-dbcp</groupId>
         <artifactId>commons-dbcp</artifactId>
      </dependency>

      <dependency>
         <groupId>commons-el</groupId>
         <artifactId>commons-el</artifactId>
      </dependency>

      <dependency>
         <groupId>commons-fileupload</groupId>
         <artifactId>commons-fileupload</artifactId>
      </dependency>

      <dependency>
         <groupId>commons-httpclient</groupId>
         <artifactId>commons-httpclient</artifactId>
         <scope>provided</scope> <!-- by JBossAS -->
      </dependency>

      <dependency>
         <groupId>commons-io</groupId>
         <artifactId>commons-io</artifactId>
         <version>1.3.1</version>
      </dependency>

      <dependency>
         <groupId>commons-logging</groupId>
         <artifactId>commons-logging</artifactId>
         <scope>provided</scope> <!-- by JBossAS -->
      </dependency>

      <dependency>
         <groupId>commons-validator</groupId>
         <artifactId>commons-validator</artifactId>
      </dependency>

      <!-- used by a test JSP -->
      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-entitymanager</artifactId>
         <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
         <scope>provided</scope> <!-- by JBossAS -->
      </dependency>

      <dependency>
         <groupId>i18nlog</groupId>
         <artifactId>i18nlog</artifactId>
      </dependency>

      <dependency>
         <groupId>javax.el</groupId>
         <artifactId>el-api</artifactId>
         <scope>provided</scope> <!-- by JBossAS Tomcat -->
      </dependency>

      <!-- transitive dependency needed for JspC -->
      <dependency>
         <groupId>javax.servlet</groupId>
         <artifactId>servlet-api</artifactId>
         <scope>provided</scope> <!-- by JBossAS -->
      </dependency>

      <dependency>
         <groupId>javax.servlet</groupId>
         <artifactId>jsp-api</artifactId>
         <scope>provided</scope> <!-- by JBossAS -->
      </dependency>

      <dependency>
         <groupId>javax.faces</groupId>
         <artifactId>jsf-api</artifactId>
         <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
         <scope>provided</scope> <!-- by JBossAS -->
      </dependency>

      <!-- We leverage a few utility classes (HtmlUtils, etc.) from the JSF RI impl jar. -->
      <dependency>
         <groupId>javax.faces</groupId>
         <artifactId>jsf-impl</artifactId>
         <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
         <scope>provided</scope> <!-- by JBossAS -->
      </dependency>

      <dependency>
         <groupId>org.apache.geronimo.specs</groupId>
         <artifactId>geronimo-javamail_1.3.1_spec</artifactId>
         <!-- The Sun javamail jar isn't available from a public repo due to licensing issues,
              so use the Geronimo one instead. -->
         <version>1.3</version>
         <scope>provided</scope> <!-- by JBossAS -->
      </dependency>

      <dependency>
         <groupId>javax.servlet</groupId>
         <artifactId>jstl</artifactId>
         <version>1.1.2</version>
      </dependency>

      <!-- used by DisplayTag_test.jsp -->
      <dependency>
         <groupId>junit</groupId>
         <artifactId>junit</artifactId>
      </dependency>

      <dependency>
         <groupId>org.opensymphony.quartz</groupId>
         <artifactId>quartz</artifactId>
         <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
         <scope>provided</scope> <!-- by JBossAS itself, which the container build has packaged with 1.6.5 -->
      </dependency>

      <dependency>
         <groupId>org.opensymphony.quartz</groupId>
         <artifactId>quartz-oracle</artifactId>
         <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
         <scope>provided</scope> <!-- by JBossAS itself, which the container build has packaged with 1.6.5 -->
      </dependency>

      <dependency>
         <groupId>org.jvnet</groupId>
         <artifactId>inflector</artifactId>
         <version>0.7.0</version>
      </dependency>

      <dependency>
         <groupId>org.richfaces.framework</groupId>
         <artifactId>richfaces-api</artifactId>
         <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
      </dependency>

      <dependency>
         <groupId>org.richfaces.framework</groupId>
         <artifactId>richfaces-impl</artifactId>
         <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
      </dependency>

      <dependency>
         <groupId>org.richfaces.ui</groupId>
         <artifactId>richfaces-ui</artifactId>
         <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
      </dependency>

      <dependency>
         <groupId>struts</groupId>
         <artifactId>struts</artifactId>
         <version>1.2.9</version>
         <exclusions>
            <exclusion>
               <groupId>antlr</groupId>
               <artifactId>antlr</artifactId>
               <!-- provided by JBossAS default config -->
            </exclusion>
         </exclusions>
      </dependency>

      <dependency>
         <groupId>struts</groupId>
         <artifactId>struts-el</artifactId>
         <version>1.2.9</version>
         <exclusions>
            <exclusion>
               <groupId>antlr</groupId>
               <artifactId>antlr</artifactId>
               <!-- provided by JBossAS default config -->
            </exclusion>
         </exclusions>
      </dependency>

      <dependency>
         <groupId>struts-menu</groupId>
         <artifactId>struts-menu</artifactId>
         <version>2.3</version>
         <exclusions>
            <exclusion>
               <groupId>antlr</groupId>
               <artifactId>antlr</artifactId>
               <!-- provided by JBossAS default config -->
            </exclusion>
         </exclusions>
      </dependency>

      <dependency>
         <groupId>taglibs</groupId>
         <artifactId>standard</artifactId>
         <version>1.1.2</version>
      </dependency>

      <dependency>
         <groupId>xalan</groupId>
         <artifactId>xalan</artifactId>
         <version>2.5.1</version>
         <scope>provided</scope> <!-- by JBossAS -->
      </dependency>

      <dependency>
         <groupId>xerces</groupId>
         <artifactId>xercesImpl</artifactId>
         <scope>provided</scope> <!-- by JBossAS -->
      </dependency>

      <!-- ============ Testing ========================-->
      <dependency>
          <groupId>org.javassist</groupId>
          <artifactId>javassist</artifactId>
          <scope>test</scope>
      </dependency>

      <dependency>
          <groupId>org.codehaus.groovy</groupId>
          <artifactId>groovy-all</artifactId>
      </dependency>

   </dependencies>


   <build>
      <finalName>rhq-portal</finalName>
      <plugins>

          <plugin>
              <groupId>org.codehaus.groovy.maven</groupId>
              <artifactId>gmaven-plugin</artifactId>
              <version>1.0</version>
              <executions>
                  <execution>
                      <goals>
                          <goal>compile</goal>
                          <goal>testCompile</goal>
                      </goals>
                  </execution>
              </executions>
          </plugin>

         <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <configuration>
               <webResources>
                  <resource>
                     <filtering>false</filtering>
                     <directory>${basedir}/src/main/webapp</directory>
                  </resource>
                  <resource>
                     <filtering>true</filtering>
                     <directory>${basedir}/src/main/webapp-filtered</directory>
                  </resource>
               </webResources>
            </configuration>
         </plugin>

         <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
               <execution>
                  <id>Generate I18N Resource Bundles</id>
                  <phase>process-classes</phase>
                  <configuration>
                     <target>
                        <!-- generate the I18N resource bundles -->
                        <taskdef name="i18n" classpathref="maven.runtime.classpath" classname="mazz.i18n.ant.I18NAntTask" />
                        <i18n outputdir="${project.build.outputDirectory}" defaultlocale="en" verbose="false" append="false" verify="true">
                           <classpath refid="maven.runtime.classpath" />
                           <classfileset dir="${project.build.outputDirectory}">
                              <include name="**/*I18NResourceKeys.class" />
                           </classfileset>
                        </i18n>
                     </target>
                  </configuration>
                  <goals>
                     <goal>run</goal>
                  </goals>
               </execution>
               <execution>
                  <id>Maintain an unfiltered copy of i18n properties files</id>
                  <phase>process-classes</phase>
                  <configuration>
                     <target>
                        <copy todir="${project.build.outputDirectory}">
                           <fileset dir="src/main/webapp-filtered/WEB-INF/classes">
                              <include name="ApplicationResources.properties" />
                           </fileset>
                           <mapper type="glob" from="*" to="*.unfiltered" />
                        </copy>
                     </target>
                  </configuration>
                  <goals>
                     <goal>run</goal>
                  </goals>
               </execution>
            </executions>
         </plugin>

      </plugins>

   </build>


   <profiles>

      <profile>
         <id>dev</id>

         <properties>
            <rhq.rootDir>../../../..</rhq.rootDir>
            <rhq.containerDir>${rhq.rootDir}/${rhq.devContainerServerPath}</rhq.containerDir>
            <rhq.deploymentName>${project.build.finalName}.war</rhq.deploymentName>
            <rhq.deploymentDir>${rhq.containerDir}/${rhq.earDeployDir}/${rhq.deploymentName}</rhq.deploymentDir>
         </properties>

         <build>
            <plugins>

               <plugin>
                 <artifactId>maven-antrun-plugin</artifactId>
                 <executions>

                     <execution>
                        <id>deploy-classes</id>
                        <phase>compile</phase>
                        <configuration>
                          <target>
                            <property name="classes.dir" location="${rhq.deploymentDir}/WEB-INF/classes" />
                            <echo>*** Copying updated files from target/classes to ${classes.dir}...</echo>
                            <copy todir="${classes.dir}" verbose="${rhq.verbose}">
                               <fileset dir="target/classes" />
                            </copy>
                            <property name="deployment.dir" location="${rhq.deploymentDir}" />
                            <echo>*** Copying updated files from src${file.separator}main${file.separator}webapp${file.separator} to ${deployment.dir}${file.separator}...</echo>
                            <copy todir="${deployment.dir}" verbose="${rhq.verbose}">
                               <fileset dir="${basedir}/src/main/webapp" />
                            </copy>
                            <!-- TODO: Also copy the files from src/main/webapp-filtered/, and then filter them ourselves. -->
                          </target>
                        </configuration>
                        <goals>
                          <goal>run</goal>
                        </goals>
                     </execution>

                     <execution>
                        <id>deploy</id>
                        <phase>package</phase>
                        <configuration>
                          <target>
                            <property name="deployment.dir" location="${rhq.deploymentDir}" />
                            <echo>*** Copying updated files from target${file.separator}${project.build.finalName}${file.separator} to ${deployment.dir}${file.separator}...</echo>
                            <copy todir="${deployment.dir}" verbose="${rhq.verbose}">
                               <fileset dir="${basedir}/target/${project.build.finalName}" />
                            </copy>
                          </target>
                        </configuration>
                        <goals>
                          <goal>run</goal>
                        </goals>
                     </execution>

                     <execution>
                        <id>undeploy</id>
                        <phase>clean</phase>
                        <configuration>
                          <target>
                            <property name="deployment.dir" location="${rhq.deploymentDir}" />
                            <echo>*** Deleting ${deployment.dir}${file.separator}...</echo>
                            <delete dir="${deployment.dir}" />
                          </target>
                        </configuration>
                        <goals>
                          <goal>run</goal>
                        </goals>
                     </execution>

                  </executions>
               </plugin>

            </plugins>
         </build>
      </profile>

      <profile>
         <id>dist</id>

         <build>
            <plugins>

               <plugin>
                  <groupId>org.mortbay.jetty</groupId>
                  <artifactId>jetty-jspc-maven-plugin</artifactId>
                  <version>${jetty-jspc-maven-plugin.version}</version>
                  <configuration>
                     <keepSources>false</keepSources>
                     <validateXml>false</validateXml>
                     <generatedClasses>${project.build.directory}/jspc-output</generatedClasses>
                  </configuration>
                  <executions>
                     <execution><goals><goal>jspc</goal></goals></execution>
                  </executions>
               </plugin>

            </plugins>
         </build>
      </profile>
   </profiles>

</project>

