<?xml version="1.0" encoding="UTF-8"?>
<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">
    <parent>
        <groupId>org.mule</groupId>
        <artifactId>mule-maven-client</artifactId>
        <version>2.2.1</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <packaging>pom</packaging>

    <artifactId>mule-maven-client-maven-context-tests</artifactId>
    <name>Mule Maven Client Tests within a Maven context</name>

    <modules>
        <module>test-maven-plugin</module>
    </modules>

    <properties>
        <maven.plugin.plugin.version>3.9.0</maven.plugin.plugin.version>
        <maven.invoker.plugin.version>3.6.0</maven.invoker.plugin.version>

        <oldMuleArtifactVersion>2.1.0-SNAPSHOT</oldMuleArtifactVersion>
    </properties>

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

    <dependencies>
        <dependency>
            <groupId>org.mule</groupId>
            <artifactId>mule-maven-client-api</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.mule</groupId>
            <artifactId>mule-maven-client-impl</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-annotations</artifactId>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <version>${maven.plugin.plugin.version}</version>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>integration</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property>
                    <name>!muleMavenClientIntegration</name>
                </property>
            </activation>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-invoker-plugin</artifactId>
                            <version>${maven.invoker.plugin.version}</version>
                            <configuration>
                                <debug>${debug}</debug>
                                <streamLogs>${debug}</streamLogs>
                                <showErrors>${debug}</showErrors>
                                <failIfNoProjects>true</failIfNoProjects>
                                <projectsDirectory>src/it</projectsDirectory>
                                <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
                                <postBuildHookScript>verify</postBuildHookScript>
                                <scriptVariables>
                                    <localRepository>${project.build.directory}</localRepository>
                                </scriptVariables>
                                <addTestClassPath>true</addTestClassPath>
                                <mavenOpts>${mavenOpts}</mavenOpts>
                                <invokerPropertiesFile>invoker.properties</invokerPropertiesFile>
                                <goals>
                                    <goal>clean</goal>
                                    <goal>install</goal>
                                </goals>
                            </configuration>
                            <executions>
                                <execution>
                                    <id>integration-test</id>
                                    <phase>integration-test</phase>
                                    <goals>
                                        <goal>install</goal>
                                        <goal>run</goal>
                                    </goals>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>
    </profiles>

</project>
