<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         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.mule.tooling</groupId>
        <artifactId>mule-runtime-tooling-client-parent</artifactId>
        <version>4.7.2</version>
    </parent>

    <artifactId>mule-agent-rest-client</artifactId>
    <name>Mule Runtime Tooling Client :: Mule Agent REST</name>
    <description>REST Client for Mule Agent Tooling Services</description>

    <properties>
        <formatterConfigPath>../formatter.xml</formatterConfigPath>
        <mulePluginClassifier>mule-plugin</mulePluginClassifier>
    </properties>

    <build>
        <testResources>
            <testResource>
                <filtering>true</filtering>
                <directory>${basedir}/src/test/resources</directory>
            </testResource>
        </testResources>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.mule.tooling</groupId>
            <artifactId>mule-tooling-api</artifactId>
        </dependency>

        <dependency>
            <groupId>org.mule.runtime</groupId>
            <artifactId>mule-extensions-api-persistence</artifactId>
        </dependency>

        <dependency>
            <groupId>org.glassfish.jersey.core</groupId>
            <artifactId>jersey-client</artifactId>
        </dependency>

        <dependency>
            <groupId>org.glassfish.jersey.media</groupId>
            <artifactId>jersey-media-json-jackson</artifactId>
        </dependency>

        <dependency>
            <groupId>org.glassfish.jersey.media</groupId>
            <artifactId>jersey-media-multipart</artifactId>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.jaxrs</groupId>
            <artifactId>jackson-jaxrs-base</artifactId>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.jaxrs</groupId>
            <artifactId>jackson-jaxrs-json-provider</artifactId>
        </dependency>

        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
        </dependency>

        <dependency>
            <groupId>com.mulesoft.agent</groupId>
            <artifactId>mule-agent-web-interface</artifactId>
        </dependency>

        <dependency>
            <groupId>com.mulesoft.agent</groupId>
            <artifactId>mule-agent-api</artifactId>
        </dependency>

        <dependency>
            <groupId>org.mule.tooling</groupId>
            <artifactId>tooling-agent-plugin-api</artifactId>
            <version>${project.version}</version>
        </dependency>

        <!-- Test -->
        <dependency>
            <groupId>org.mule.tooling</groupId>
            <artifactId>mule-runtime-process-controller</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.awaitility</groupId>
            <artifactId>awaitility</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mule.tooling</groupId>
            <artifactId>mule-runtime-tooling-tests-utils</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.icegreen</groupId>
            <artifactId>greenmail</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>io.qameta.allure</groupId>
            <artifactId>allure-junit4</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.github.tomakehurst</groupId>
            <artifactId>wiremock</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.commons</groupId>
                    <artifactId>commons-lang3</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>2.0.7</version>
        </dependency>

    </dependencies>

    <profiles>
        <profile>
            <id>prepare-integration-tests</id>
            <activation>
                <property>
                    <name>skipPrepareIntegrationTests</name>
                    <value>!true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-invoker-plugin</artifactId>
                        <version>3.1.0</version>
                        <configuration>
                            <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
                            <goals>install</goals>
                        </configuration>
                        <executions>
                            <execution>
                                <id>integration-test</id>
                                <phase>process-test-resources</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <activation>
                <jdk>17</jdk>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>${maven.surefire.plugin.version}</version>
                        <configuration>
                            <argLine>--add-opens java.base/java.io=ALL-UNNAMED --add-opens java.desktop/java.beans=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.xml/javax.xml.namespace=ALL-UNNAMED --add-exports java.base/sun.net.www.protocol.jar=ALL-UNNAMED</argLine>
                            <excludedGroups>NeedsJava8Test</excludedGroups>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>java11</id>
            <activation>
                <jdk>11</jdk>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>${maven.surefire.plugin.version}</version>
                        <configuration>
                            <argLine>--add-opens java.base/java.io=ALL-UNNAMED --add-opens java.desktop/java.beans=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.xml/javax.xml.namespace=ALL-UNNAMED --add-exports java.base/sun.net.www.protocol.jar=ALL-UNNAMED</argLine>
                            <excludedGroups>NeedsJava8Test</excludedGroups>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
