<?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>
  <parent>
    <groupId>org.apache.myfaces.tobago</groupId>
    <artifactId>tobago-example</artifactId>
    <version>3.0.2</version>
  </parent>
  <artifactId>tobago-example-demo</artifactId>
  <packaging>war</packaging>
  <name>Tobago Example Demo</name>
  <description>Demonstration and documentation application.</description>

  <properties>
    <openwebbeans.version>1.2.8</openwebbeans.version>
    <deltaspike.version>1.7.1</deltaspike.version>
    <!--<arquillian.browser>firefox</arquillian.browser>-->
    <!-- phantomjs works not with CSP (report-only) -->
    <arquillian.browser>phantomjs</arquillian.browser>
    <selenium.version>3.0.1</selenium.version>
    <tomee.version>7.0.1</tomee.version>
  </properties>
  <build>
    <finalName>tobago-example-demo</finalName>
    <testResources>
      <testResource>
        <directory>src/test/resources</directory>
        <filtering>true</filtering>
      </testResource>
    </testResources>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>xml-maven-plugin</artifactId>
        <version>1.0.1</version>
        <executions>
          <execution>
            <goals>
              <goal>validate</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <validationSets>
            <validationSet>
              <dir>src/main/webapp</dir>
              <includes>
                <include>**/*.xhtml</include>
              </includes>
              <excludes>
                  <exclude>**/x-error-in-syntax.xhtml</exclude>
              </excludes>
            </validationSet>
          </validationSets>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <webResources>
            <resource>
              <targetPath>src</targetPath>
              <directory>${basedir}/src/main/java</directory>
            </resource>
          </webResources>
        </configuration>
      </plugin>
      <plugin>
        <!-- TODO test glassfish -->
        <groupId>org.glassfish</groupId>
        <artifactId>maven-embedded-glassfish-plugin</artifactId>
        <version>3.1.1</version>
        <configuration>
          <port>8080</port>
          <contextRoot>/</contextRoot>
          <autoDelete>true</autoDelete>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <configuration>
          <loginServices>
            <loginService implementation="org.eclipse.jetty.security.HashLoginService">
              <name>demo-realm</name>
              <config>src/test/resources/realm.properties</config>
            </loginService>
          </loginServices>
          <stopKey>stopKey</stopKey>
          <stopPort>9999</stopPort>
          <systemProperties>
            <systemProperty>
              <name>derby.stream.error.file</name>
              <value>target/derby.log</value>
            </systemProperty>
          </systemProperties>
        </configuration>
        <dependencies>
        </dependencies>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <excludes><!-- TODO define group for ArquillianTests and use excludeGroups -->
            <exclude>**/ArquillianTest.java</exclude>
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-failsafe-plugin</artifactId>
        <configuration>
          <includes><!-- TODO define group for ArquillianTests or use convention *IT.java, *ITCase.java -->
            <include>**/ArquillianTest.java</include>
          </includes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>io.fabric8</groupId>
        <artifactId>docker-maven-plugin</artifactId>
        <version>0.15.9</version>
        <configuration>
          <images>
            <image>
              <name>selenium/standalone-firefox:${selenium.version}</name>
              <run>
                <ports>
                  <port>4444:4444</port>
                </ports>
              </run>
            </image>
          </images>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.jboss.arquillian</groupId>
        <artifactId>arquillian-bom</artifactId>
        <version>1.1.12.Final</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>
      <dependency>
        <groupId>org.jboss.arquillian.selenium</groupId>
        <artifactId>selenium-bom</artifactId>
        <version>${selenium.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.jboss.arquillian.extension</groupId>
        <artifactId>arquillian-drone-bom</artifactId>
        <version>2.0.1.Final</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>
      <dependency>
        <groupId>org.jboss.arquillian.graphene</groupId>
        <artifactId>graphene-webdriver</artifactId>
        <version>2.1.0.Final</version>
        <type>pom</type>
        <scope>test</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>

    <!-- Tobago -->
    <dependency>
      <groupId>org.apache.myfaces.tobago</groupId>
      <artifactId>tobago-example-data</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>oro</groupId>
      <artifactId>oro</artifactId>
      <version>2.0.8</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.myfaces.test</groupId>
      <artifactId>myfaces-test20</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.myfaces.tobago</groupId>
      <artifactId>tobago-core</artifactId>
      <version>${project.version}</version>
      <classifier>tests</classifier>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
    </dependency>

    <!-- DeltaSpike -->
    <dependency>
      <groupId>org.apache.deltaspike.modules</groupId>
      <artifactId>deltaspike-jsf-module-impl</artifactId>
      <version>${deltaspike.version}</version>
    </dependency>

    <dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-annotation_1.0_spec</artifactId>
      <!-- compile or provided depends on the used server -->
      <scope>compile</scope>
    </dependency>

    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-validator</artifactId>
      <version>4.3.2.Final</version>
    </dependency>

    <dependency>
      <groupId>org.jboss.arquillian.junit</groupId>
      <artifactId>arquillian-junit-container</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.shrinkwrap.resolver</groupId>
      <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.arquillian.graphene</groupId>
      <artifactId>graphene-webdriver</artifactId>
      <type>pom</type>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <profiles>

    <profile>
      <id>jsf-provided</id>
      <!-- use this profile for containers that provide JSF and OWB e.g. WebSphere 8.5 -->
      <activation>
        <property>
          <name>jsf</name>
          <value>provided</value>
        </property>
      </activation>
      <dependencies>
        <!-- Specs -->
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-jcdi_1.0_spec</artifactId>
          <version>1.0</version>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-validation_1.0_spec</artifactId>
          <version>1.1</version>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-atinject_1.0_spec</artifactId>
          <version>1.0</version>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-interceptor_1.1_spec</artifactId>
          <version>1.0</version>
          <scope>provided</scope>
        </dependency>
      </dependencies>
    </profile>

    <profile>
      <id>myfaces-2.0</id>
      <activation>
        <property>
          <name>!jsf</name>
        </property>
      </activation>
      <dependencies>

        <!-- Specs -->
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-jcdi_1.0_spec</artifactId>
          <version>1.0</version>
        </dependency>
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-validation_1.0_spec</artifactId>
          <version>1.1</version>
        </dependency>
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-atinject_1.0_spec</artifactId>
          <version>1.0</version>
        </dependency>
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-interceptor_1.1_spec</artifactId>
          <version>1.0</version>
        </dependency>

        <!-- OWB -->
        <dependency>
          <groupId>org.apache.openwebbeans</groupId>
          <artifactId>openwebbeans-jsf</artifactId>
          <version>${openwebbeans.version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.openwebbeans</groupId>
          <artifactId>openwebbeans-web</artifactId>
          <version>${openwebbeans.version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.openwebbeans</groupId>
          <artifactId>openwebbeans-resource</artifactId>
          <version>${openwebbeans.version}</version>
        </dependency>

      </dependencies>
    </profile>

    <profile>
      <id>myfaces-2.1</id>
      <activation>
        <property>
          <name>jsf</name>
          <value>myfaces-2.1</value>
        </property>
      </activation>
      <dependencies>

        <!-- Specs -->
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-jcdi_1.0_spec</artifactId>
          <version>1.0</version>
        </dependency>
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-validation_1.0_spec</artifactId>
          <version>1.1</version>
        </dependency>
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-atinject_1.0_spec</artifactId>
          <version>1.0</version>
        </dependency>
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-interceptor_1.1_spec</artifactId>
          <version>1.0</version>
        </dependency>

        <!-- OWB -->
        <dependency>
          <groupId>org.apache.openwebbeans</groupId>
          <artifactId>openwebbeans-jsf</artifactId>
          <version>${openwebbeans.version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.openwebbeans</groupId>
          <artifactId>openwebbeans-web</artifactId>
          <version>${openwebbeans.version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.openwebbeans</groupId>
          <artifactId>openwebbeans-resource</artifactId>
          <version>${openwebbeans.version}</version>
        </dependency>

      </dependencies>
    </profile>

    <profile>
      <id>myfaces-2.2</id>
      <activation>
        <property>
          <name>jsf</name>
          <value>myfaces-2.2</value>
        </property>
      </activation>
      <dependencies>

        <!-- Specs -->
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-jcdi_1.0_spec</artifactId>
          <version>1.0</version>
        </dependency>
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-validation_1.0_spec</artifactId>
          <version>1.1</version>
        </dependency>
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-atinject_1.0_spec</artifactId>
          <version>1.0</version>
        </dependency>
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-interceptor_1.1_spec</artifactId>
          <version>1.0</version>
        </dependency>

        <!-- OWB -->
        <dependency>
          <groupId>org.apache.openwebbeans</groupId>
          <artifactId>openwebbeans-jsf</artifactId>
          <version>${openwebbeans.version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.openwebbeans</groupId>
          <artifactId>openwebbeans-web</artifactId>
          <version>${openwebbeans.version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.openwebbeans</groupId>
          <artifactId>openwebbeans-resource</artifactId>
          <version>${openwebbeans.version}</version>
        </dependency>

      </dependencies>
    </profile>

    <profile>
      <id>mojarra-2.0</id>
      <activation>
        <property>
          <name>jsf</name>
          <value>mojarra-2.0</value>
        </property>
      </activation>
      <dependencies>

        <!-- Specs -->
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-jcdi_1.0_spec</artifactId>
          <version>1.0</version>
        </dependency>
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-validation_1.0_spec</artifactId>
          <version>1.1</version>
        </dependency>
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-atinject_1.0_spec</artifactId>
          <version>1.0</version>
        </dependency>
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-interceptor_1.1_spec</artifactId>
          <version>1.0</version>
        </dependency>

        <!-- OWB -->
        <dependency>
          <groupId>org.apache.openwebbeans</groupId>
          <artifactId>openwebbeans-jsf</artifactId>
          <version>${openwebbeans.version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.openwebbeans</groupId>
          <artifactId>openwebbeans-web</artifactId>
          <version>${openwebbeans.version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.openwebbeans</groupId>
          <artifactId>openwebbeans-resource</artifactId>
          <version>${openwebbeans.version}</version>
        </dependency>

      </dependencies>
    </profile>

    <profile>
      <id>mojarra-2.1</id>
      <activation>
        <property>
          <name>jsf</name>
          <value>mojarra-2.1</value>
        </property>
      </activation>
      <dependencies>

        <!-- Specs -->
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-jcdi_1.0_spec</artifactId>
          <version>1.0</version>
        </dependency>
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-validation_1.0_spec</artifactId>
          <version>1.1</version>
        </dependency>
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-atinject_1.0_spec</artifactId>
          <version>1.0</version>
        </dependency>
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-interceptor_1.1_spec</artifactId>
          <version>1.0</version>
        </dependency>

        <!-- OWB -->
        <dependency>
          <groupId>org.apache.openwebbeans</groupId>
          <artifactId>openwebbeans-jsf</artifactId>
          <version>${openwebbeans.version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.openwebbeans</groupId>
          <artifactId>openwebbeans-web</artifactId>
          <version>${openwebbeans.version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.openwebbeans</groupId>
          <artifactId>openwebbeans-resource</artifactId>
          <version>${openwebbeans.version}</version>
        </dependency>

      </dependencies>
    </profile>

    <profile>
      <id>mojarra-2.2</id>
      <activation>
        <property>
          <name>jsf</name>
          <value>mojarra-2.2</value>
        </property>
      </activation>
      <dependencies>

        <!-- Specs -->
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-jcdi_1.0_spec</artifactId>
          <version>1.0</version>
        </dependency>
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-validation_1.0_spec</artifactId>
          <version>1.1</version>
        </dependency>
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-atinject_1.0_spec</artifactId>
          <version>1.0</version>
        </dependency>
        <dependency>
          <groupId>org.apache.geronimo.specs</groupId>
          <artifactId>geronimo-interceptor_1.1_spec</artifactId>
          <version>1.0</version>
        </dependency>

        <!-- OWB -->
        <dependency>
          <groupId>org.apache.openwebbeans</groupId>
          <artifactId>openwebbeans-jsf</artifactId>
          <version>${openwebbeans.version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.openwebbeans</groupId>
          <artifactId>openwebbeans-web</artifactId>
          <version>${openwebbeans.version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.openwebbeans</groupId>
          <artifactId>openwebbeans-resource</artifactId>
          <version>${openwebbeans.version}</version>
        </dependency>

      </dependencies>
    </profile>

    <profile>
      <!--
       mvn package cargo:start -Ptomcat7x
       XXX not working yet
      -->
      <id>tomcat7x</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <version>1.4.6</version>
            <configuration>
              <container>
                <containerId>tomcat7x</containerId>
                <zipUrlInstaller>
                  <url>http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.50/bin/apache-tomcat-7.0.50.zip</url>
                </zipUrlInstaller>
                <output>${project.build.directory}/tomcat7/container.log</output>
                <append>false</append>
                <log>${project.build.directory}/tomcat7/cargo.log</log>
              </container>
              <configuration>
                <home>${project.build.directory}/tomcat7/container</home>
              </configuration>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <!--
       mvn package cargo:start -Ptomcat8x
       XXX not working yet
      -->
      <id>tomcat8x</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <version>1.4.6</version>
            <configuration>
              <container>
                <containerId>tomcat8x</containerId>
                <zipUrlInstaller>
                  <url>http://archive.apache.org/dist/tomcat/tomcat-8/v8.0.1/bin/apache-tomcat-8.0.1.zip</url>
                </zipUrlInstaller>
                <output>${project.build.directory}/tomcat8/container.log</output>
                <append>false</append>
                <log>${project.build.directory}/tomcat8/cargo.log</log>
              </container>
              <configuration>
                <home>${project.build.directory}/tomcat8/container</home>
              </configuration>
            </configuration>
          </plugin>
        </plugins>
      </build>
      <dependencies>
        <dependency>
          <groupId>org.jboss.arquillian.container</groupId>
          <artifactId>arquillian-tomcat-embedded-8</artifactId>
          <version>1.0.0.CR7</version>
          <scope>test</scope>
        </dependency>
      </dependencies>
    </profile>

    <profile>
      <id>tomee</id>
      <dependencies>
        <dependency>
          <groupId>org.apache.tomee</groupId>
          <artifactId>apache-tomee</artifactId>
          <version>${tomee.version}</version>
          <classifier>webprofile</classifier>
          <type>zip</type>
          <scope>test</scope>
          <exclusions>
            <exclusion>
              <groupId>org.slf4j</groupId>
              <artifactId>slf4j-jdk14</artifactId>
            </exclusion>
          </exclusions>
        </dependency>
        <dependency>
          <groupId>org.apache.tomee</groupId>
          <artifactId>arquillian-tomee-remote</artifactId>
          <version>${tomee.version}</version>
          <scope>test</scope>
          <exclusions>
            <exclusion>
              <groupId>org.slf4j</groupId>
              <artifactId>slf4j-jdk14</artifactId>
            </exclusion>
          </exclusions>
        </dependency>
      </dependencies>
    </profile>

    <profile>
      <id>qunit-integration-tests</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <configuration>
              <includes>
                <include>**/QUnitTests.java</include>
              </includes>
              <forkMode>never</forkMode>
            </configuration>
            <executions>
              <execution>
                <goals>
                  <goal>integration-test</goal>
                  <goal>verify</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
      <dependencies>
        <dependency>
          <groupId>org.apache.tomee</groupId>
          <artifactId>apache-tomee</artifactId>
          <version>${tomee.version}</version>
          <classifier>webprofile</classifier>
          <type>zip</type>
          <scope>test</scope>
          <exclusions>
            <exclusion>
              <groupId>org.slf4j</groupId>
              <artifactId>slf4j-jdk14</artifactId>
            </exclusion>
          </exclusions>
        </dependency>
        <dependency>
          <groupId>org.apache.tomee</groupId>
          <artifactId>arquillian-tomee-remote</artifactId>
          <version>${tomee.version}</version>
          <scope>test</scope>
          <exclusions>
            <exclusion>
              <groupId>org.slf4j</groupId>
              <artifactId>slf4j-jdk14</artifactId>
            </exclusion>
          </exclusions>
        </dependency>
      </dependencies>
    </profile>

    <profile>
      <id>checkstyle-for-view-definition-language</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-checkstyle-plugin</artifactId>
            <configuration>
              <configLocation>META-INF/checkstyle-tobago.xml</configLocation>
              <includes>**/*.xhtml</includes>
              <excludes>**/*.java</excludes>
              <sourceDirectory>src/main/webapp</sourceDirectory>
            </configuration>
            <dependencies>
              <dependency>
                <groupId>org.apache.myfaces.tobago</groupId>
                <artifactId>tobago-core</artifactId>
                <version>${project.version}</version>
              </dependency>
            </dependencies>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
