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

    <parent>
        <groupId>org.richfaces</groupId>
        <artifactId>richfaces-parent</artifactId>
        <version>4.5.5.Final</version>
    </parent>

    <artifactId>richfaces-core</artifactId>
    <name>RichFaces Core</name>

    <description>The RichFaces core framework.</description>

    <properties>
        <version.richfaces>4.5.5.Final</version.richfaces>
    </properties>

    <dependencies>

        <!-- Java EE Web Profile -->
        <dependency>
            <groupId>org.jboss.spec</groupId>
            <artifactId>jboss-javaee-6.0</artifactId>
            <type>pom</type>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.jboss.spec.javax.faces</groupId>
                    <artifactId>jboss-jsf-api_2.1_spec</artifactId>
                </exclusion>
                <exclusion>
                    <artifactId>xalan</artifactId>
                    <groupId>xalan</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- CDK -->
        <dependency>
            <groupId>org.richfaces.cdk</groupId>
            <artifactId>annotations</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Runtime Dependencies -->
        <dependency>
            <groupId>net.sourceforge.cssparser</groupId>
            <artifactId>cssparser</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </dependency>

        <!-- Push dependencies -->
        <dependency>
            <groupId>org.atmosphere</groupId>
            <artifactId>atmosphere-runtime</artifactId>
            <optional>true</optional>
        </dependency>

        <!-- Optional dependencies -->
        <dependency>
            <groupId>org.jboss.cache</groupId>
            <artifactId>jbosscache-core</artifactId>
            <optional>true</optional>
            <exclusions>
                <exclusion>
                    <artifactId>jboss-logging-spi</artifactId>
                    <groupId>org.jboss.logging</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>net.sf.ehcache</groupId>
            <artifactId>ehcache</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>opensymphony</groupId>
            <artifactId>oscache</artifactId>
            <optional>true</optional>
        </dependency>

        <!-- Test Dependencies -->
        <dependency>
            <groupId>org.jboss.test-jsf</groupId>
            <artifactId>htmlunit-client</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>javax.servlet</groupId>
                    <artifactId>javax.servlet-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.jboss.test-jsf</groupId>
            <artifactId>jsf-mock</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.test-jsf</groupId>
            <artifactId>jsf-mockito</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.test-jsf</groupId>
            <artifactId>jsf-test-scriptunit</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.easymock</groupId>
            <artifactId>easymock</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.easymock</groupId>
            <artifactId>easymockclassextension</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>xmlunit</groupId>
            <artifactId>xmlunit</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- tests -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- Resource Optimizer -->
        <dependency>
            <groupId>org.reflections</groupId>
            <artifactId>reflections</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>com.google.collections</groupId>
                    <artifactId>google-collections</artifactId>
                </exclusion>
            </exclusions>
            <scope>compile</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.yahoo.platform.yui</groupId>
            <artifactId>yuicompressor</artifactId>
            <scope>compile</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.beust</groupId>
            <artifactId>jcommander</artifactId>
            <scope>compile</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.jboss.el</groupId>
            <artifactId>jboss-el</artifactId>
            <scope>compile</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.richfaces</groupId>
            <artifactId>richfaces-build-resources</artifactId>
            <scope>compile</scope>
            <optional>true</optional>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <configuration>
                    <excludes>**/CollectionDataModel.java,**/NoRowAvailableException.java</excludes>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>buildnumber-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>create</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <doCheck>false</doCheck>
                    <doUpdate>false</doUpdate>
                    <revisionOnScmFailure>unknown</revisionOnScmFailure>
                    <timestampFormat>{0,date,MM/dd/yyyy h:mm:ss a}</timestampFormat>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>src/main/config</source>
                                <source>src/main/resource-optimizer</source>
                                <source>target/generated-sources/main/java</source>
                                <source>target/generated-sources/main/resources</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

        </plugins>

    </build>

    <profiles>
        <profile>
            <id>generate-cdk-and-resource</id>
            <activation>
                <property>
                    <name>!generation.skip</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>precompile-sources-for-cdk</id>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>compile</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.richfaces.cdk</groupId>
                        <artifactId>richfaces-cdk-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>cdk-generate-sources</id>
                                <phase>process-sources</phase>
                                <goals>
                                    <goal>generate</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <charset>UTF-8</charset>
                            <locale>en</locale>
                            <templates>
                                <fileSet>
                                    <directory>${project.basedir}/src/main/java</directory>
                                    <includes>
                                        <include>**/*.template.xml</include>
                                    </includes>
                                </fileSet>
                            </templates>
                        </configuration>
                        <dependencies>
                            <dependency>
                                <groupId>org.jboss.spec</groupId>
                                <artifactId>jboss-javaee-6.0</artifactId>
                                <version>${version.jboss-javaee}</version>
                                <type>pom</type>
                                <exclusions>
                                    <exclusion>
                                        <artifactId>xalan</artifactId>
                                        <groupId>xalan</groupId>
                                    </exclusion>
                                </exclusions>
                            </dependency>
                            <dependency>
                                <groupId>org.richfaces</groupId>
                                <artifactId>richfaces-build-resources</artifactId>
                                <version>${version.richfaces}</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>jsf_ri</id>
            <activation>
                <property>
                    <name>!jsf_profile</name>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>org.glassfish</groupId>
                    <artifactId>javax.faces</artifactId>
                    <scope>compile</scope>
                    <optional>true</optional>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>jsf_jboss</id>
            <activation>
                <property>
                    <name>jsf_profile</name>
                    <value>jboss</value>
                </property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>org.jboss.spec.javax.faces</groupId>
                    <artifactId>jboss-jsf-api_2.1_spec</artifactId>
                    <scope>compile</scope>
                    <optional>true</optional>
                </dependency>
                <dependency>
                    <groupId>com.sun.faces</groupId>
                    <artifactId>jsf-impl</artifactId>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>myfaces</id>
            <activation>
                <property>
                    <name>jsf_profile</name>
                    <value>myfaces</value>
                </property>
            </activation>
            <properties>
                <arquillian.richfaces.jsfProvider>myfaces</arquillian.richfaces.jsfProvider>
                <arquillian.richfaces.jsfImplementation>org.apache.myfaces.core:myfaces-impl</arquillian.richfaces.jsfImplementation>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>org.apache.myfaces.core</groupId>
                    <artifactId>myfaces-api</artifactId>
                    <scope>compile</scope>
                    <optional>true</optional>
                </dependency>
                <dependency>
                    <groupId>org.apache.myfaces.core</groupId>
                    <artifactId>myfaces-impl</artifactId>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>

        <!-- Release -->
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <!-- JavaDoc -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>generate-javadoc</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- JSDoc -->
                    <plugin>
                        <groupId>gr.abiss.mvn.plugins</groupId>
                        <artifactId>maven-jstools-plugin</artifactId>
                        <version>0.7</version>
                        <executions>
                            <execution>
                                <id>jsdoc</id>
                                <configuration>
                                    <jsDir>${project.basedir}/src/main/resources/META-INF/resources</jsDir>
                                    <includes>**/*.js</includes>
                                    <caseSensitive>true</caseSensitive>
                                </configuration>
                                <goals>
                                    <goal>jsdoc</goal>
                                </goals>
                                <phase>process-sources</phase>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-jar-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>pack-jsodcs</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                                <configuration>
                                    <classesDirectory>target/site/jsdoc</classesDirectory>
                                    <classifier>jsdoc</classifier>
                                    <excludes>
                                        <exclude>**/symbols/src/*</exclude>
                                    </excludes>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
