<?xml version="1.0" encoding="UTF-8"?>
<!--

    JBoss, Home of Professional Open Source

    Copyright 2011, Red Hat, Inc., and individual contributors
    by the @authors tag. See the copyright.txt in the distribution for a
    full listing of individual contributors.

    Licensed 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/xsd/maven-4.0.0.xsd">

   <modelVersion>4.0.0</modelVersion>

   <parent>
      <groupId>org.jboss.seam.validation</groupId>
      <artifactId>seam-validation-parent</artifactId>
      <version>3.0.0.CR1</version>
      <relativePath>../../pom.xml</relativePath>
   </parent>

   <artifactId>seam-validation-example</artifactId>
   <packaging>war</packaging>

   <name>Seam Validation Module Example</name>

   <description>
		An example of using Seam Validation with a Servlet.
	</description>

   <!-- Explicitly set Weld version until it is updated in Seam parent POM -->
   <properties>
      <weld.version>1.1.0.Final</weld.version>
   </properties>

   <dependencies>

      <dependency>
         <groupId>javax.enterprise</groupId>
         <artifactId>cdi-api</artifactId>
         <scope>provided</scope>
      </dependency>

      <dependency>
         <groupId>${project.groupId}</groupId>
         <artifactId>seam-validation-api</artifactId>
      </dependency>
      <dependency>
         <groupId>${project.groupId}</groupId>
         <artifactId>seam-validation-impl</artifactId>
      </dependency>

      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-validator</artifactId>
      </dependency>

      <dependency>
        <groupId>org.jboss.spec.javax.servlet</groupId>
        <artifactId>jboss-servlet-api_3.0_spec</artifactId>
        <scope>provided</scope>
      </dependency>
      
      <!-- Using Jetty 6 for now, as Servlet injection does not yet work on 7 (see WELD-784) -->
      <dependency>
         <groupId>org.mortbay.jetty</groupId>
         <artifactId>jetty</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.mortbay.jetty</groupId>
         <artifactId>jetty-plus</artifactId>
         <scope>test</scope>         
      </dependency>
      <dependency>
         <groupId>org.mortbay.jetty</groupId>
         <artifactId>jetty-naming</artifactId>
         <scope>test</scope>         
      </dependency>
      
      <!-- required by Weld's servlet listener -->
      <dependency>
         <groupId>org.jboss.spec.javax.servlet.jsp</groupId>
         <artifactId>jboss-jsp-api_2.2_spec</artifactId>
         <scope>test</scope>
      </dependency>
   </dependencies>
   

   <build>
      <finalName>validation-helloworld</finalName>
      
      <!-- We don't force license headers -->
      <!--plugins>
         <plugin>
            <groupId>com.mycila.maven-license-plugin</groupId>
            <artifactId>maven-license-plugin</artifactId>
         </plugin>      
      </plugins-->
   </build>
   
   <profiles>
      <profile>
         <id>distribution</id>
         <activation>
            <property>
               <name>release</name>
            </property>
         </activation>
         <build>
            <plugins>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-assembly-plugin</artifactId>
               </plugin>
            </plugins>
         </build>
      </profile>     
   
      <profile>
         <id>servlet</id>
         <activation>
            <activeByDefault>true</activeByDefault>
         </activation>
         <dependencies>
            <dependency>
               <groupId>org.jboss.weld.servlet</groupId>
               <artifactId>weld-servlet</artifactId>
            </dependency>
         </dependencies>
         <build>
            <plugins>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-war-plugin</artifactId>
                  <configuration>
                     <webResources>
                        <resource>
                           <directory>src/main/webapp</directory>
                        </resource>
                        <resource>
                           <directory>src/main/webapp-jetty</directory>
                        </resource>                        
                     </webResources>
                  </configuration>
               </plugin>
      
               <!-- use 'mvn jetty:run' or 'mvn jetty:run-war' to run example on command line -->
               <plugin>
                  <groupId>org.mortbay.jetty</groupId>
                  <artifactId>maven-jetty-plugin</artifactId>
                  <version>${mortbay.jetty.version}</version>
                  <configuration>
                     <contextPath>seam-validation-example</contextPath>
                     <jettyEnvXml>${basedir}/src/main/webapp-jetty/WEB-INF/jetty-env.xml</jettyEnvXml>
                     <webAppConfig>
                        <baseResource implementation="org.mortbay.resource.ResourceCollection">
                           
                           <!-- use this for 'mvn jetty:run' -->
                           <resourcesAsCSV>src/main/webapp-jetty,src/main/webapp</resourcesAsCSV>
                           
                           <!-- OR use this for 'mvn jetty:run-war' -->
                           <!-- <resourcesAsCSV>src/main/webapp-jetty,src/main/webapp,${project.build.directory}/${project.build.finalName}</resourcesAsCSV>  -->
                        </baseResource>
                     </webAppConfig>
                     <connectors>
                        <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
                           <port>8080</port>
                        </connector>
                     </connectors>
                  </configuration>
               </plugin>
            </plugins>
         </build>         
      </profile>
      
      <profile>
         <id>jee</id>
         <build>
            <plugins>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-war-plugin</artifactId>
                  <configuration>
                     <webResources>
                        <resource>
                           <directory>src/main/webapp</directory>
                        </resource>                     
                        <resource>
                           <directory>src/main/webapp-jee</directory>
                        </resource>
                     </webResources>
                  </configuration>
               </plugin>
            </plugins>
         </build>         
      </profile>      
   </profiles>
</project>
