<?xml version="1.0" encoding="utf-8"?>
<!--
    JBoss, Home of Professional Open Source Copyright 2010, 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>5.0.0.Alpha3</version>
    </parent>

    <groupId>org.richfaces.compat</groupId>
    <artifactId>richfaces-components-parent</artifactId>
    <version>4.5.0.Alpha2</version>
    <packaging>pom</packaging>
    <name>RichFaces UI Components Parent</name>

    <properties>
        <version.richfaces>5.0.0.Alpha3</version.richfaces>
        <version.richfaces.ui>4.5.0.Alpha2</version.richfaces.ui>
    </properties>

    <build>
        <pluginManagement>
            <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>
                </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/templates</source>
                                    <source>${project.build.directory}/generated-sources/main/java</source>
                                    <source>${project.build.directory}/generated-sources/main/resources</source>
                                </sources>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <configuration>
                    <rules>
                        <requirePluginVersions>
                            <!-- During development SNAPSHOT versions of the CDK plugin are used.
                                 This setting ignores the no SNAPSHOT rule for the CDK  -->
                            <unCheckedPluginList>org.richfaces.cdk:richfaces-cdk-maven-plugin, org.richfaces:richfaces-resource-optimizer-maven-plugin</unCheckedPluginList>
                        </requirePluginVersions>
                    </rules>
                </configuration>
            </plugin>
        </plugins>

    </build>

    <dependencies>
        <!-- runtime -->
        <dependency>
            <groupId>org.richfaces</groupId>
            <artifactId>richfaces</artifactId>
        </dependency>

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

        <!-- tests -->
        <dependency>
            <groupId>org.richfaces</groupId>
            <artifactId>richfaces</artifactId>
            <scope>test</scope>
            <type>test-jar</type>
            <version>${version.richfaces}</version>
        </dependency>

        <dependency>
            <groupId>org.jboss.test-jsf</groupId>
            <artifactId>jsf-test-stage</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.test-jsf</groupId>
            <artifactId>htmlunit-client</artifactId>
            <scope>test</scope>
        </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.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.richfaces</groupId>
                <artifactId>richfaces-build</artifactId>
                <version>5.0.0.Alpha3</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.richfaces</groupId>
                <artifactId>richfaces</artifactId>
                <version>5.0.0.Alpha3</version>
            </dependency>
            <dependency>
                <groupId>org.richfaces.compat</groupId>
                <artifactId>richfaces-components-a4j</artifactId>
                <version>${version.richfaces.ui}</version>
            </dependency>
            <dependency>
                <groupId>org.richfaces.compat</groupId>
                <artifactId>richfaces-components-rich</artifactId>
                <version>${version.richfaces.ui}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <profiles>
        <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>
    
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <configuration>
                            <aggregate>true</aggregate>
                        </configuration>
                        <executions>
                            <execution>
                                <id>generate-source</id>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <!-- 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>
                </plugins>
            </build>
        </profile>
        
        <!-- Profile for quick CDK turnaround using JRebel and CDK command-line generator -->
        <profile>
            <id>jrebel</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>unpack-dependencies</id>
                                <phase>process-sources</phase>
                                <goals>
                                    <goal>unpack-dependencies</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.zeroturnaround</groupId>
                        <artifactId>jrebel-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>generate-rebel-xml</id>
                                <phase>process-resources</phase>
                                <goals>
                                    <goal>generate</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
