<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
	   
-->

<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>

  <name>Apache MyFaces Trinidad Examples</name>
  <description>Parent project for the Trinidad Example Projects</description>

  <parent>
    <groupId>org.apache.myfaces.trinidad</groupId>
    <artifactId>trinidad</artifactId>
    <version>2.2.1</version>
  </parent>

  <artifactId>trinidad-example</artifactId>
  <packaging>pom</packaging>

  <properties>
    <portlet.version>1.0</portlet.version>
  </properties>


  <!-- Project dependencies -->
  <dependencies>
    <!-- Apache Trinidad -->
    <dependency>
      <groupId>org.apache.myfaces.trinidad</groupId>
      <artifactId>trinidad-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.myfaces.trinidad</groupId>
      <artifactId>trinidad-impl</artifactId>
    </dependency>
    
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>jstl</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.myfaces.portlet-bridge</groupId>
      <artifactId>portlet-bridge-api</artifactId>
    </dependency>
      
    <dependency>
      <groupId>org.apache.myfaces.portlet-bridge</groupId>
      <artifactId>portlet-bridge-impl</artifactId>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
    </dependency>
    
    <dependency>
      <groupId>javax.portlet</groupId>
      <artifactId>portlet-api</artifactId>
    </dependency>
  </dependencies>
  
  <modules>
    <module>trinidad-blank</module>
    <module>trinidad-demo</module>
  </modules>

  <!-- 
  This is needed because an error in the master pom's configuration for checkstyle does not allow for
  resource bundles to be named properly.  Eventually I'm thinking we'll want our own checkstyle configurations.
  -->
  <build>  
    <plugins>
      <plugin>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <configuration>
          <configLocation>trinidad/checkstyle.xml</configLocation>
          <headerLocation>default/myfaces-header.txt</headerLocation>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.apache.myfaces.buildtools</groupId>
            <artifactId>checkstyle-rules</artifactId>
            <version>3</version>
          </dependency>
          <dependency>
            <groupId>org.apache.myfaces.trinidad</groupId>
            <artifactId>trinidad-build</artifactId>
            <version>${project.version}</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>


  <profiles>
    <!-- 
      This profile is for preparing a release.  Execute this profile like this:
      
       mvn release:prepare
       
       NOTE: the apache-release profile is invoked on any execution of the maven-release-plugin
       as per the apache-10 common ancestor file.
     -->
     <!--
    <profile>
     <id>apache-release</id>
     <modules>
       <module>trinidad-example-assembly</module>
     </modules>      
    </profile>
    -->
        <profile>
            <id>prepare-release</id>
            <activation>
                <property>
                    <name>prepareRelease</name>
                </property>
            </activation>
            <modules>
                <module>trinidad-example-assembly</module>
            </modules>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-release-plugin</artifactId>
                        <configuration>
                            <arguments>-DprepareRelease</arguments>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>perform-release</id>
            <activation>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <modules>
                <module>trinidad-example-assembly</module>
            </modules>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-release-plugin</artifactId>
                        <configuration>
                            <arguments>-Papache-release -DperformRelease</arguments>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

    
    <!--
      This profile activates MyFaces as the release to use for these demos.  By default
      MyFaces is used when these examples are run in Jetty and/or used with the -PincludeJSF
      flag.  To invoke this profile, simply do not include a -Djsf= property on your maven
      command line.  Execute this profile like this:
      
      mvn -PjettyConfig jetty:run
    -->    
    <profile>
      <id>jettyConfig</id>
      <dependencyManagement>
        <dependencies>
          <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-api</artifactId>
            <scope>compile</scope>
          </dependency>

          <dependency>
            <groupId>com.sun.faces</groupId>
            <artifactId>jsf-impl</artifactId>
            <scope>runtime</scope>
          </dependency>

          <dependency>
            <groupId>org.apache.myfaces.core</groupId>
            <artifactId>myfaces-api</artifactId>
            <scope>compile</scope>
          </dependency>

          <dependency>
            <groupId>org.apache.myfaces.core</groupId>
            <artifactId>myfaces-impl</artifactId>
            <scope>runtime</scope>
          </dependency>
          
         </dependencies>
       </dependencyManagement>
     </profile>
     
     <!--
       The component showcase should only be included if we are not performing a release.  The activation of this
       profile should only be invoked if release:perform has not been invoked.  Notice that this WILL invoke durring
       a release:prepare.
     -->
     <profile>
      <id>buildShowcase</id>
      <activation>
        <property>
          <name>!performRelease</name>
        </property>
      </activation>      
      
      <modules>
        <module>trinidad-components-showcase</module>
      </modules>          
     </profile>
    
    <profile>
      <id>myfaces</id>
      <activation>
        <property>
          <name>!jsf</name>
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>org.apache.myfaces.core</groupId>
          <artifactId>myfaces-api</artifactId>
        </dependency>
        <dependency>
          <groupId>org.apache.myfaces.core</groupId>
          <artifactId>myfaces-impl</artifactId>
        </dependency>
        <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>jcl-over-slf4j</artifactId>
          <version>${slf4j.version}</version>
        </dependency>
        <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
          <version>${slf4j.version}</version>
        </dependency>
        <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-log4j12</artifactId>
          <version>${slf4j.version}</version>
        </dependency>
      </dependencies>
      
    </profile>
    <!--
      This profile activates the JSF RI as the release to use for these demos.  When activated
      the JSF RI is used when these examples are run in Jetty and/or used with the 
      -PincludeJSF flag.  To invoke this profile, simply do include a -Djsf=ri property on 
      your maven command line.  Execute this profile like this:
      
      mvn -PjettyConfig -Djsf=ri jetty:run
    -->    
    <profile>
      <id>jsfri</id>
      <activation>
        <property>
          <name>jsf</name>
          <value>ri</value>
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>com.sun.faces</groupId>
          <artifactId>jsf-api</artifactId>
        </dependency>
        <dependency>
          <groupId>com.sun.faces</groupId>
          <artifactId>jsf-impl</artifactId>
        </dependency>
      </dependencies>      
    </profile>
  </profiles>
</project>
