<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.apache.myfaces.tomahawk</groupId>
        <artifactId>tomahawk-examples-project</artifactId>
        <version>1.1.15-SNAPSHOT</version>
    </parent>
    <scm>
        <connection>scm:svn:http://svn.apache.org/repos/asf/myfaces/tomahawk/trunk/examples/simple20</connection>
        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/myfaces/tomahawk/trunk/examples/simple20</developerConnection>
        <url>http://svn.apache.org/viewcvs.cgi/myfaces/tomahawk/trunk/examples/simple20</url>
    </scm>   
    <artifactId>myfaces-example-simple20</artifactId>
    <packaging>war</packaging>
    <name>Tomahawk Examples: Simple 2.0</name>
        
    <dependencies>
        <dependency>
            <groupId>org.apache.myfaces.tomahawk</groupId>
            <artifactId>tomahawk20</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.1.1</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.13</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
    
    <build>
        <!--
        <finalName>${artifactId}</finalName>
        -->

        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>src/main/java</directory>
            </resource>
        </resources>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                  <source>1.5</source>
                  <target>1.5</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-source-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-source</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <properties>
        <jsf-mojarra.version>2.0.6</jsf-mojarra.version>
        <maven.jetty.plugin.version>7.4.4.v20110707</maven.jetty.plugin.version>
        <cargo.version>1.1.1</cargo.version>
    </properties>
    <profiles>
            <!-- To run the examples using MyFaces 2.0: -Djsf=20 -->
        <profile>
            <id>myfaces-2.0</id>
            <activation>
                <property>
                    <name>!jsf</name>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>org.apache.myfaces.core</groupId>
                    <artifactId>myfaces-api</artifactId>
                    <version>${myfaces-core20-version}</version>
                </dependency>
                <dependency>
                    <groupId>org.apache.myfaces.core</groupId>
                    <artifactId>myfaces-impl</artifactId>
                    <version>${myfaces-core20-version}</version>
                    <scope>runtime</scope>
                </dependency>
                <dependency>
                    <groupId>javax.servlet</groupId>
                    <artifactId>jstl</artifactId>
                    <version>1.2</version>
                </dependency>
                <dependency>
                    <groupId>taglibs</groupId>
                    <artifactId>standard</artifactId>
                    <version>1.1.2</version>
                </dependency>
                <dependency>
                    <groupId>org.apache.geronimo.specs</groupId>
                    <artifactId>geronimo-el_1.0_spec</artifactId>
                    <scope>provided</scope>
                </dependency>

            </dependencies>

            <properties>
                <jsf_implementation>MyFaces 2.0</jsf_implementation>
            </properties>
        </profile>
        <profile>
            <id>myfaces-2.1</id>
            <activation>
                <property>
                    <name>jsf</name>
                    <value>21</value>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>org.apache.myfaces.core</groupId>
                    <artifactId>myfaces-api</artifactId>
                    <version>${myfaces-core21-version}</version>
                </dependency>
                <dependency>
                    <groupId>org.apache.myfaces.core</groupId>
                    <artifactId>myfaces-impl</artifactId>
                    <version>${myfaces-core21-version}</version>
                    <scope>runtime</scope>
                </dependency>
                <dependency>
                    <groupId>javax.servlet</groupId>
                    <artifactId>jstl</artifactId>
                    <version>1.2</version>
                </dependency>
                <dependency>
                    <groupId>taglibs</groupId>
                    <artifactId>standard</artifactId>
                    <version>1.1.2</version>
                </dependency>
                <dependency>
                    <groupId>org.apache.geronimo.specs</groupId>
                    <artifactId>geronimo-el_1.0_spec</artifactId>
                    <scope>provided</scope>
                </dependency>

            </dependencies>

            <properties>
                <jsf_implementation>MyFaces 2.1</jsf_implementation>
            </properties>
        </profile>
        
        <!-- To use the examples using the Sun's JSF Reference Implementation 1.2 : -Djsf=ri12 -->
        <profile>
            <id>jsfri-2.0</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>
                </dependency>
                <dependency>
                    <groupId>com.sun.faces</groupId>
                    <artifactId>jsf-impl</artifactId>
                    <version>${jsf-mojarra.version}</version>
                    <scope>runtime</scope>
                </dependency>
                <dependency>
                    <groupId>org.apache.geronimo.specs</groupId>
                    <artifactId>geronimo-el_1.0_spec</artifactId>
                    <scope>provided</scope>
                </dependency>
            </dependencies>

            <properties>
                <jsf_implementation>JSF-RI 2.0</jsf_implementation>
            </properties>
        </profile>
    
        <profile>
            <id>generate-assembly</id>
            <activation>
              <property>
                <name>performRelease</name>
                <value>true</value>
              </property>
            </activation>
            <build>        
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>dependency-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>unpack-source</id>
                                <phase>process-resources</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.apache.myfaces.tomahawk</groupId>
                                            <artifactId>${artifactId}</artifactId>
                                            <version>${project.version}</version>
                                            <classifier>sources</classifier>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>org.apache.myfaces.tomahawk</groupId>
                                            <artifactId>tomahawk20</artifactId>
                                            <version>${project.version}</version>
                                            <classifier>sources</classifier>
                                        </artifactItem>
                                    </artifactItems>
                                    <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/src</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <!-- Plugin embedded jetty 7 container. 
                 Just running use:
                 mvn clean jetty:run or mvn clean -Djsf=myfaces -Dcontainer=jetty jetty:run 
            -->
            <!-- For debugging use (attach debugger port 8000):
                 mvnDebug clean jetty:run or mvn clean -Djsf=myfaces -Dcontainer=jetty jetty:run 
            -->
            <id>jettyConfig</id>
            <activation>
                <property>
                    <name>!container</name>
                </property>
            </activation>
            <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>
                            <scanIntervalSeconds>5</scanIntervalSeconds>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        
        <profile>
            <!-- Plugin embedded tomcat 6 container. 
                 Just running use:
                 mvn clean -Djsf=myfaces -Dcontainer=tomcat tomcat:run-war 
            -->
            <!-- For debugging use (attach debugger port 8000):
                 mvnDebug clean -Djsf=myfaces -Dcontainer=tomcat tomcat:run-war 
            -->
            <id>tomcatConfig</id>
            <activation>
                <property>
                    <name>container</name>
                    <value>tomcat</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                      <groupId>org.codehaus.mojo</groupId>
                      <artifactId>tomcat-maven-plugin</artifactId>
                      <version>1.1</version>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <!-- Installed tomcat 7 running war file through cargo 
                 Attach debugger on port 8000:
                 mvn clean -Djsf=myfaces -Dcontainer=tomcat7 install cargo:run -->
            <id>cargo-tomcat7</id>
            <activation>
                <property>
                    <name>container</name>
                    <value>tomcat7</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                      <groupId>org.codehaus.cargo</groupId>
                      <artifactId>cargo-maven2-plugin</artifactId>
                      <version>${cargo.version}</version>
                      <configuration>
                        <wait>true</wait>
                        <properties>
                            <cargo.servlet.port>8080</cargo.servlet.port>
                            <cargo.jvmargs>
                              -Xdebug
                              -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
                              -Xnoagent
                              -Djava.compiler=NONE
                            </cargo.jvmargs>
                        </properties>
                        <container>
                          <containerId>tomcat7x</containerId>
                          <zipUrlInstaller>
                            <url>http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.16/bin/apache-tomcat-7.0.16.zip</url>
                            <!-- 
                            <installDir>${basedir}/tomcat7x</installDir>
                             -->
                            <downloadDir>${basedir}/downloads</downloadDir>
                            <extractDir>${basedir}/tomcat7x</extractDir>
                          </zipUrlInstaller>
                        </container>
                        <configuration>
                          <home>${basedir}/target/tomcat7x</home>
                          <properties>
                            <cargo.jvmargs>-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 -Xnoagent -Djava.compiler=NONE</cargo.jvmargs>
                          </properties>
                        </configuration>
                      </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
