<?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">

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>io.openliberty.tools</groupId>
        <artifactId>liberty-maven</artifactId>
        <version>3.2.3</version>
    </parent>

    <artifactId>liberty-maven-plugin</artifactId>
    <packaging>maven-plugin</packaging>
    <name>liberty-maven-plugin</name>
    <description>Liberty Maven Plugin : Install, Start/Stop, Package, Create Server, Deploy/Undeploy applications</description>

    <pluginRepositories>
        <!-- Configure Sonatype OSS Maven snapshots repository -->
        <pluginRepository>
            <id>sonatype-nexus-snapshots</id>
            <name>Sonatype Nexus Snapshots</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <releases>
                <enabled>false</enabled>
            </releases>
        </pluginRepository>
    </pluginRepositories>

    <dependencies>
        <dependency>
            <groupId>io.openliberty.tools</groupId>
            <artifactId>liberty-ant-tasks</artifactId>
            <version>1.9.4</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>plugin-support</artifactId>
            <version>1.0-alpha-1</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.maven</groupId>
                    <artifactId>maven-project</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.maven</groupId>
                    <artifactId>maven-artifact</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.maven</groupId>
                    <artifactId>maven-plugin-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.shared</groupId>
            <artifactId>maven-mapping</artifactId>
            <version>3.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
            <version>3.5.0</version>
        </dependency>
        <!-- dependencies to annotations -->
        <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-annotations</artifactId>
            <version>3.5.2</version>
            <scope>provided</scope><!-- annotations are needed only to build the plugin -->
        </dependency>
        <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-utils</artifactId>
            <version>3.1.0</version>
        </dependency>
        <dependency>
            <groupId>org.sonatype.plexus</groupId>
            <artifactId>plexus-build-api</artifactId>
            <version>0.0.7</version>
        </dependency>
        <dependency>
            <groupId>io.openliberty.tools</groupId>
            <artifactId>ci.common</artifactId>
            <version>1.8.5</version>
        </dependency>
        <dependency>
            <groupId>org.twdata.maven</groupId>
            <artifactId>mojo-executor</artifactId>
            <version>2.3.0</version>
        </dependency>
        <dependency>
            <groupId>xmlunit</groupId>
            <artifactId>xmlunit</artifactId>
            <version>1.6</version>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>offline-its</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-invoker-plugin</artifactId>
                        <version>3.1.0</version>
                        <configuration>
                            <debug>false</debug>
                            <goals>
                                <goal>install</goal>
                            </goals>
                            <projectsDirectory>src/it</projectsDirectory>
                            <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
                            <properties>
                                <libertyInstallDir>${libertyInstallDir}</libertyInstallDir>
                            </properties>
                            <profiles>
                                <profile>offline-its</profile>
                            </profiles>
                            <streamLogs>true</streamLogs>
                        </configuration>
                        <executions>
                            <execution>
                                <id>integration-test</id>
                                <goals>
                                    <goal>install</goal>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>online-its</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-invoker-plugin</artifactId>
                        <version>3.1.0</version>
                        <configuration>
                            <debug>false</debug>
                            <goals>
                                <goal>install</goal>
                            </goals>
                            <projectsDirectory>src/it</projectsDirectory>
                            <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
                            <properties>
                                <runtime>${runtime}</runtime>
                                <runtimeGroupId>${runtimeGroupId}</runtimeGroupId>
                                <runtimeArtifactId>${runtimeArtifactId}</runtimeArtifactId>
                                <runtimeKernelId>${runtimeKernelId}</runtimeKernelId>
                                <runtimeVersion>${runtimeVersion}</runtimeVersion>
                            </properties>
                            <streamLogs>true</streamLogs>
                            <profiles>
                                <profile>online-its</profile>
                            </profiles>
                            <streamLogs>true</streamLogs>
                        </configuration>
                        <executions>
                            <execution>
                                <id>integration-test</id>
                                <goals>
                                    <goal>install</goal>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Profiles for WLP vs OL -->
        <profile>
            <id>wlp-its</id>
            <activation>
                <property>
                    <name>runtime</name>
                    <value>wlp</value>
                </property>
            </activation>
            <properties>
                <runtime>wlp</runtime>
                <runtimeGroupId>com.ibm.websphere.appserver.runtime</runtimeGroupId>
                <runtimeArtifactId>wlp-javaee7</runtimeArtifactId>
                <runtimeKernelId>wlp-kernel</runtimeKernelId>
                <runtimeVersion>${runtimeVersion}</runtimeVersion>
            </properties>
        </profile>
        <profile>
            <id>ol-its</id>
            <activation>
                <property>
                    <name>runtime</name>
                    <value>ol</value>
                </property>
            </activation>
            <properties>
                <runtime>ol</runtime>
                <runtimeGroupId>io.openliberty</runtimeGroupId>
                <runtimeArtifactId>openliberty-runtime</runtimeArtifactId>
                <runtimeKernelId>openliberty-kernel</runtimeKernelId>
                <runtimeVersion>${runtimeVersion}</runtimeVersion>
            </properties>
            <build>
                <pluginManagement>
                  <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-invoker-plugin</artifactId>
                        <configuration>
                            <pomExcludes>
                                <pomExclude>basic-it/pom.xml</pomExclude>
                                <pomExclude>assembly-it/pom.xml</pomExclude>
                                <pomExclude>assembly-with-code-it/pom.xml</pomExclude>
                                <pomExclude>server-param-pom-override-it/pom.xml</pomExclude>
                                <pomExclude>server-param-default-it/pom.xml</pomExclude>
                                <pomExclude>server-param-configdir-override-it/pom.xml</pomExclude>
                                <pomExclude>install-features-it/pom.xml</pomExclude>
                            </pomExcludes>
                        </configuration>
                    </plugin>
                </plugins>
            </pluginManagement>
        </build>
    </profile>

</profiles>

<prerequisites>
    <maven>3.0</maven>
</prerequisites>
</project>
