<?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>
    <groupId>org.apache.myfaces.examples.helloworld20</groupId>
    <artifactId>myfaces-helloworld20</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>A custom project using MyFaces 2.0</name>
    <url>http://www.myorganization.org</url>

    <properties>
        <jsf-myfaces.version>2.0.12</jsf-myfaces.version>
        <jsf-mojarra.version>2.0.8</jsf-mojarra.version> 
        <!-- works with 7.4.5.v20110725 -->
        <maven.jetty.plugin.version>7.6.0.v20120127</maven.jetty.plugin.version>
    </properties>

    <build>
        <finalName>myfaces-helloworld20</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>myfaces</id>
            <activation>
                <property>
                    <name>!jsf</name>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>org.apache.myfaces.core</groupId>
                    <artifactId>myfaces-api</artifactId>
                    <version>${jsf-myfaces.version}</version>
                    <scope>compile</scope>
                </dependency>
                <dependency>
                    <groupId>org.apache.myfaces.core</groupId>
                    <artifactId>myfaces-impl</artifactId>
                    <version>${jsf-myfaces.version}</version>
                    <scope>runtime</scope>
                </dependency>
            </dependencies>
        </profile>

        <profile>
            <!-- Activate by adding -Djsf=mojarra -->
            <id>mojarra</id>
            <activation>
                <property>
                    <name>jsf</name>
                    <value>mojarra</value>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>com.sun.faces</groupId>
                    <artifactId>jsf-api</artifactId>
                    <version>${jsf-mojarra.version}</version>
                    <scope>compile</scope>
                </dependency>
                <dependency>
                    <groupId>com.sun.faces</groupId>
                    <artifactId>jsf-impl</artifactId>
                    <version>${jsf-mojarra.version}</version>
                    <scope>runtime</scope>
                </dependency>
            </dependencies>
            <repositories>
                <repository>
                    <id>java.net</id>
                    <url>http://download.java.net/maven/2</url>
                </repository>
            </repositories>
        </profile>

        <profile>
            <!-- Plugin embedded jetty 7 container. 
                 Just running use:
                 mvn clean jetty:run or mvn clean -Djsf=myfaces -PjettyConfig jetty:run 
            -->
            <!-- For debugging use (attach debugger port 8000):
                 mvnDebug clean jetty:run or mvn clean -Djsf=myfaces -PjettyConfig jetty:run 
            -->
            <id>jettyConfig</id>
            <build>
                <plugins>
                    <plugin>
                        <!--This plugin allows to run the war using mvn jetty:run -->
                        <groupId>org.mortbay.jetty</groupId>
                        <artifactId>jetty-maven-plugin</artifactId>
                        <version>${maven.jetty.plugin.version}</version>
                        <configuration>
                            <webAppConfig>
                                <contextPath>/${artifactId}</contextPath>
                            </webAppConfig>
                            <scanIntervalSeconds>5</scanIntervalSeconds>
                        </configuration>
                        <dependencies>
                            <dependency>
                               <groupId>javax.el</groupId>
                               <artifactId>javax.el-api</artifactId>
                               <version>2.2.1</version>
                               <scope>provided</scope>
                           </dependency>
                           <dependency>
                               <groupId>org.glassfish.web</groupId>
                               <artifactId>javax.el</artifactId>
                               <version>2.2.1</version>
                               <scope>provided</scope>
                           </dependency>
                        </dependencies>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <!-- Project dependencies -->
    <dependencies>
        
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.2</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

</project>
