<?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.portals.pluto</groupId>
        <artifactId>pluto</artifactId>
        <version>2.1.0-M3</version>
    </parent>
    
    <artifactId>pluto-testsuite</artifactId>
    <packaging>war</packaging>
    <name>Apache Pluto Testsuite Portlet</name>
  
    <dependencies>
        <dependency>
            <groupId>org.apache.portals</groupId>
            <artifactId>portlet-api_2.0_spec</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <scope>compile</scope>
            <exclusions>
                <exclusion>
                    <groupId>javax.servlet</groupId>
                    <artifactId>jsp-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>commons-digester</groupId>
            <artifactId>commons-digester</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-jdk14</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>taglibs</groupId>
            <artifactId>standard</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>
    </dependencies>
  
    <!-- Build configuration -->
    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <!-- configure maven-war-plugin to use updated web.xml -->
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <webXml>${project.build.directory}/pluto-resources/web.xml</webXml>
                </configuration>
            </plugin>
            <!-- bind 'pluto:assemble' goal to 'process-resources' lifecycle -->
            <plugin>
                <groupId>org.apache.portals.pluto</groupId>
                <artifactId>maven-pluto-plugin</artifactId>
                <version>${pom.version}</version>
                <executions>
                    <execution>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>assemble</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- workaround for war processing of m-r-r-plugin causing the generated NOTICE and LICENSE file to be put under WEB-INF/classes/META-INF -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-remote-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>process</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/${build.finalName}</outputDirectory>
                            <attached>false</attached>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- Don't attach source or javadoc archive -->
            <plugin>
                <artifactId>maven-source-plugin</artifactId>
                <configuration>
                    <attach>false</attach>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
        </plugins>
    </build>
  
    <profiles>
        <profile>
            <id>deploy-testsuite</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property><name>deploy.dir</name></property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>integration-test</phase>
                                <configuration>
                                    <tasks>
                                    <!--
                                      Use this to build and deploy the testsuite war.
                                      PORTLET_DEPLOY_DIR is an environmental variable 
                                      pointing to the hot-deploy directory of your portal.
                                      You can also use -Ddeploy.dir=<path to deployment dir>
                                      on the command line when invoking maven:
                                      mvn -Ddeploy.dir=/pluto-1.1.4/webapps integration-test
                                    -->
                                        <property environment="env" />
                                        <property name="deploy.dir" value="${env.PORTLET_DEPLOY_DIR}" />
                                        <copy file="target/${pom.build.finalName}.war" tofile="${deploy.dir}/testsuite.war" />
                                    </tasks>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>deploy-testsuite-by-env</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property><name>env.PORTLET_DEPLOY_DIR</name></property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>integration-test</phase>
                                <configuration>
                                    <tasks>
                                    <!--
                                      Use this to build and deploy the testsuite war.
                                      PORTLET_DEPLOY_DIR is an environmental variable 
                                      pointing to the hot-deploy directory of your portal.
                                      You can also use -Ddeploy.dir=<path to deployment dir>
                                      on the command line when invoking maven:
                                      mvn -Ddeploy.dir=/pluto-1.1.4/webapps integration-test
                                    -->
                                        <property environment="env" />
                                        <property name="deploy.dir" value="${env.PORTLET_DEPLOY_DIR}" />
                                        <copy file="target/${pom.build.finalName}.war" tofile="${deploy.dir}/testsuite.war" />
                                    </tasks>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    
    <!-- Don't create distribution artifacts -->
        <!--<profile>-->
            <!--<id>apache-release</id>-->
            <!--<build>-->
                <!--<plugins>-->
                    <!--<plugin>-->
                        <!--<groupId>org.apache.maven.plugins</groupId>-->
                        <!--<artifactId>maven-assembly-plugin</artifactId>-->
                        <!--<configuration>-->
                            <!--<skipAssembly>true</skipAssembly>-->
                        <!--</configuration>-->
                    <!--</plugin>-->
                <!--</plugins>-->
            <!--</build>-->
        <!--</profile>-->
        <profile>
            <id>rat</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.rat</groupId>
                        <artifactId>apache-rat-plugin</artifactId>
                        <configuration>
                            <excludes combine.children="append">
                                <exclude>src/main/webapp/META-INF/SLF4J-LICENSE</exclude>
                            </excludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>  
</project>
