<?xml version="1.0" encoding="UTF-8"?>
<!-- JBoss, Home of Professional Open Source Copyright 2013, Red Hat, Inc. 
	and individual contributors by the @authors tag. See the copyright.txt in 
	the distribution for a full listing of individual contributors. This is free 
	software; you can redistribute it and/or modify it under the terms of the 
	GNU Lesser General Public License as published by the Free Software Foundation; 
	either version 2.1 of the License, or (at your option) any later version. 
	This software is distributed in the hope that it will be useful, but WITHOUT 
	ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
	FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 
	details. You should have received a copy of the GNU Lesser General Public 
	License along with this software; if not, write to the Free Software Foundation, 
	Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the 
	FSF site: http://www.fsf.org. -->

<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.richfaces</groupId>
        <artifactId>richfaces-root-parent</artifactId>
        <version>4.3.7.Final</version>
        <relativePath>../../build/parent/pom.xml</relativePath>
    </parent>

    <groupId>org.richfaces.examples</groupId>
    <artifactId>richfaces-photoalbum</artifactId>
    <name>RichFaces Photoalbum</name>
    <packaging>war</packaging>

    <properties>
        <version.richfaces>${project.version}</version.richfaces>
        <javax.faces.PROJECT_STAGE>Development</javax.faces.PROJECT_STAGE>
        <version.metadata-extractor>2.6.2</version.metadata-extractor>
        <version.jackson>1.9.12</version.jackson>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.richfaces</groupId>
                <artifactId>richfaces-bom</artifactId>
                <version>${version.richfaces}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>

		<!-- Java EE deps -->
        <dependency>
            <groupId>org.jboss.spec</groupId>
            <artifactId>jboss-javaee-web-6.0</artifactId>
            <type>pom</type>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>xalan</groupId>
                    <artifactId>xalan</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.richfaces.core</groupId>
            <artifactId>richfaces-core-impl</artifactId>
        </dependency>
        <dependency>
            <groupId>org.richfaces.ui</groupId>
            <artifactId>richfaces-components-ui</artifactId>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>4.2.7.Final</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
        </dependency>
        <dependency>
            <groupId>com.drewnoakes</groupId>
            <artifactId>metadata-extractor</artifactId>
            <version>${version.metadata-extractor}</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-jaxrs</artifactId>
            <version>${version.jackson}</version>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.arquillian.junit</groupId>
            <artifactId>arquillian-junit-container</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>release</id>
            <properties>
                <javax.faces.PROJECT_STAGE>Production</javax.faces.PROJECT_STAGE>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>group-sources</id>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <phase>package</phase>
                                <configuration>
                                    <finalName>sources</finalName>
                                    <appendAssemblyId>false</appendAssemblyId>
                                    <descriptor>assembler.xml
                                    </descriptor>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-jar-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                                <phase>package</phase>
                                <configuration>
                                    <classesDirectory>${basedir}/target/sources/sources
                                    </classesDirectory>
                                    <classifier>sources</classifier>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>arquillian-jbossas-remote</id>
            <dependencies>
                <dependency>
                    <groupId>org.jboss.spec</groupId>
                    <artifactId>jboss-javaee-6.0</artifactId>
                    <type>pom</type>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.jboss.as</groupId>
                    <artifactId>jboss-as-arquillian-container-remote</artifactId>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.jboss.arquillian.protocol</groupId>
                    <artifactId>arquillian-protocol-servlet</artifactId>
                    <scope>test</scope>
                </dependency>
            </dependencies>
            <build>
                <testResources>
                    <testResource>
                        <directory>src/test/resources</directory>
                    </testResource>
                </testResources>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.12</version>
                        <configuration>
                            <skipTests>false</skipTests>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <build>

		<!-- Maven will append the version to the finalName (which is the name 
			given to the generated war, and hence the context root) -->
        <finalName>${project.artifactId}</finalName>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>src/main/images/short</directory>
            </resource>
            <resource>
                <directory>environment/dev</directory>
            </resource>
        </resources>

        <plugins>
			<!-- skip tests by default -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skipTests>true</skipTests>
                </configuration>
            </plugin>
			<!-- Compiler plugin enforces Java 1.6 compatibility and activates annotation 
				processors -->
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>

            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
					<!-- Java EE 6 doesn't require web.xml, Maven needs to catch up! -->
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <archive>
                        <manifestEntries>
                            <Dependencies>com.google.guava,org.slf4j</Dependencies>
                        </manifestEntries>
                    </archive>
                    <webResources>
                        <resource>
                            <directory>src/main/webapp</directory>
                            <filtering>true</filtering>
                        </resource>
                    </webResources>
                </configuration>
            </plugin>

			<!-- The JBoss AS plugin deploys your war to a local JBoss AS container -->
			<!-- To use, run: mvn package jboss-as:deploy -->
            <plugin>
                <groupId>org.jboss.as.plugins</groupId>
                <artifactId>jboss-as-maven-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.richfaces.cdk</groupId>
                <artifactId>maven-richfaces-resources-plugin</artifactId>
                <configuration>
                    <skins>
                        <skin>photoalbum</skin>
                    </skins>
                    <excludedFiles>
                        <exclude>^\Qorg.richfaces.renderkit.html.images.\E.*</exclude>
                        <exclude>^\Qorg.richfaces.renderkit.html.iconimages.\E.*</exclude>
                    </excludedFiles>
                    <includedContentTypes>
                        <include>text/css</include>
                        <include>image/.+</include>
                    </includedContentTypes>
                    <fileNameMappings>
                        <property>
                            <name>^.*showcase.*/([^/]+\.css)$</name>
                            <value>org.richfaces.showcase.css/$1</value>
                        </property>
                        <property>
                            <name>^.+/([^/]+\.(png|gif|jpg))$</name>
                            <value>org.richfaces.images/$1</value>
                        </property>
                        <property>
                            <name>^.+/([^/]+\.css)$</name>
                            <value>org.richfaces.css/$1</value>
                        </property>
                    </fileNameMappings>
                </configuration>
                <executions>
                    <execution>
                        <id>process-resources</id>
                        <goals>
                            <goal>process</goal>
                        </goals>
                        <configuration>

							<!-- default RichFaces mapping file, can be anywhere on the classpath, 
								but then you will will need to configure Resource Mapping configuration file 
								location in web.xml, refer to RichFaces Developer Guide -->
                            <staticResourceMappingFile>${project.build.outputDirectory}/META-INF/richfaces/photoalbum-packedcompressed-resource-mappings.properties</staticResourceMappingFile>

							<!-- resources will be placed in JAR/META-INF/resources/com.acme.staticResources/ 
								or WAR/WEB-INF/classes/META-INF/resources/com.acme.staticResources/ depending 
								on packaging of this project -->
                            <resourcesOutputDir>${project.build.outputDirectory}/META-INF/resources/org.richfaces.staticResource/${version.richfaces}/PackedCompressed/</resourcesOutputDir>

							<!-- resources will be located under JSF_RESOURCE_ROOT/com.acme.staticResources 
								(e.g. JAR/META-INF/com.acme.staticResources) -->
                            <staticResourcePrefix>org.richfaces.staticResource/${version.richfaces}/PackedCompressed</staticResourcePrefix>

							<!-- resources will be packaged, refer to RichFaces Developer Guide -->
                            <pack>true</pack>

							<!-- resources will be compressed, refer to RichFaces Developer Guide -->
                            <compress>true</compress>

                            <excludedFiles>
                                <exclude>^javax.faces</exclude>
                                <exclude>^\Qorg.richfaces.renderkit.html.images.\E.*</exclude>
                                <exclude>^\Qorg.richfaces.renderkit.html.iconimages.\E.*</exclude>
                                <exclude>^jquery\.js$</exclude>
                            </excludedFiles>

                        </configuration>
                    </execution>
                    <execution>
                        <id>process-resources-packed</id>
                        <goals>
                            <goal>process</goal>
                        </goals>
                        <configuration>

							<!-- default RichFaces mapping file, can be anywhere on the classpath, 
								but then you will will need to configure Resource Mapping configuration file 
								location in web.xml, refer to RichFaces Developer Guide -->
                            <staticResourceMappingFile>${project.build.outputDirectory}/META-INF/richfaces/photoalbum-packed-resource-mappings.properties</staticResourceMappingFile>

							<!-- resources will be placed in JAR/META-INF/resources/com.acme.staticResources/ 
								or WAR/WEB-INF/classes/META-INF/resources/com.acme.staticResources/ depending 
								on packaging of this project -->
                            <resourcesOutputDir>${project.build.outputDirectory}/META-INF/resources/org.richfaces.staticResource/${version.richfaces}/Packed/</resourcesOutputDir>

							<!-- resources will be located under JSF_RESOURCE_ROOT/com.acme.staticResources 
								(e.g. JAR/META-INF/com.acme.staticResources) -->
                            <staticResourcePrefix>org.richfaces.staticResource/${version.richfaces}/Packed</staticResourcePrefix>

							<!-- resources will be packaged, refer to RichFaces Developer Guide -->
                            <pack>true</pack>

							<!-- resources will be compressed, refer to RichFaces Developer Guide -->
                            <compress>false</compress>

                            <excludedFiles>
                                <exclude>^javax.faces</exclude>
                                <exclude>^\Qorg.richfaces.renderkit.html.images.\E.*</exclude>
                                <exclude>^\Qorg.richfaces.renderkit.html.iconimages.\E.*</exclude>
                                <exclude>^jquery\.js$</exclude>
                            </excludedFiles>

                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
