<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright © 2014 Piotr Soróbka <psorobka@gmail.com>.

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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <artifactId>appium-maven-plugin</artifactId>
    <packaging>maven-plugin</packaging>

    <name>Appium Maven Plugin 1.0</name>

    <parent>
        <groupId>com.github.psorobka</groupId>
        <artifactId>appium-maven-plugin-parent</artifactId>
        <version>1.1.0</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.zeroturnaround</groupId>
            <artifactId>zt-process</artifactId>
        </dependency>
    </dependencies>
    
    <build>       
        <plugins>           
            <plugin>
                <artifactId>maven-plugin-plugin</artifactId>
                <configuration>
                    <!-- see http://jira.codehaus.org/browse/MNG-5346 -->
                    <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
                </configuration>
                <executions>
                    <execution>
                        <id>mojo-descriptor</id>
                        <goals>
                            <goal>descriptor</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>help-goal</id>
                        <goals>
                            <goal>helpmojo</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <plugin>
                    <artifactId>maven-invoker-plugin</artifactId>
                    <configuration>
                        <detail>true</detail>
                        <streamLogs>true</streamLogs>
                        <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
                        <localRepositoryPath>${project.build.directory}/it-repo</localRepositoryPath>
                        <goals>
                            <goal>verify</goal>
                        </goals>
                        <projectsDirectory>${basedir}/src/test/it</projectsDirectory>
                    </configuration>
                    <executions>
                        <execution>
                            <id>integration-test</id>
                            <goals>
                                <goal>install</goal>
                                <goal>run</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
        
    <profiles>
        <profile>
            <id>integration-test</id>
            <activation>
                <property>
                    <name>full-integration-test</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-invoker-plugin</artifactId>                       
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>use-installed-node-and-appium</id>
            <activation>
                <property>
                    <name>full-integration-test</name>
                </property>
            </activation>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <artifactId>maven-invoker-plugin</artifactId>                       
                            <configuration>
                                <properties>
                                    <appium.home>../../../../node/npm/node_modules/appium</appium.home>
                                    <node.home>../../../../node</node.home>
                                </properties>
                            </configuration>
                        </plugin>                        
                    </plugins>
                </pluginManagement>
            </build>
        </profile>
    </profiles>
</project>