<?xml version="1.0"?>
<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>
    <groupId>com.mulesoft.cloudhub</groupId>
    <artifactId>cloudhub-maven-plugin</artifactId>
    <version>1.0</version>
    <packaging>maven-plugin</packaging>
    <name>CloudHub Maven Plugin</name>
    <url>http://github.com/mulesoft/cloudhub-maven-plugin</url>
    <description>
        Maven plugin for deploying Mule applications to CloudHub.
    </description>

    <licenses>
        <license>
            <name>CPAL v1.0</name>
            <url>http://www.mulesoft.com/CPAL</url>
        </license>
    </licenses>
    <mailingLists>
        <mailingList>
            <name>developers</name>
            <post>mule-esb@mulesoft.com</post>
        </mailingList>
    </mailingLists>
    <issueManagement>
        <system>jira</system>
        <url>http://www.mulesoft.org/jira/browse/MULE</url>
    </issueManagement>
    <developers>
        <developer>
            <id>asequeira</id>
            <name>Ale Sequeira</name>
            <email>alejandro.sequeira@mulesoft.com</email>
            <organizationUrl>http://mulesoft.org</organizationUrl>
        </developer>
    </developers>
    <organization>
        <name>MuleSoft Inc</name>
        <url>http://mulesoft.com/</url>
    </organization>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <mule.version>3.5.0</mule.version>
        <mule.core.version>3.5.0</mule.core.version>
        <maven.plugin.api.version>2.0</maven.plugin.api.version>
        <maven.plugin.annotations.version>3.2</maven.plugin.annotations.version>
        <plexus.utils.version>3.0.8</plexus.utils.version>
        <junit.version>4.10</junit.version>
        <mockito.version>1.9.5</mockito.version>
        <maven.dependency.plugin.version>2.8</maven.dependency.plugin.version>
        <failsafe.plugin.version>2.18.1</failsafe.plugin.version>
        <maven.antrun.plugin.version>1.7</maven.antrun.plugin.version>
        <project.info.plugin.version>2.7</project.info.plugin.version>
        <maven.invoker.plugin.version>1.9</maven.invoker.plugin.version>
        <maven.plugin.plugin.version>3.2</maven.plugin.plugin.version>
        <maven.artifact.version>2.0.9</maven.artifact.version>
        <maven.compiler.plugin.version>3.1</maven.compiler.plugin.version>
        <codehaus.plexus.archiver>2.3</codehaus.plexus.archiver>
        <enforcer.plugin.version>1.3.1</enforcer.plugin.version>
        <mave.project.version>2.0</mave.project.version>
        <hamcrest.version>1.3</hamcrest.version>
        <java.source>1.7</java.source>
        <java.target>1.7</java.target>
        <awaitility.version>1.3.5</awaitility.version>
        <cloudhub.client.version>1.5</cloudhub.client.version>
        <powermock.version>1.6.1</powermock.version>
        <maven.build.timestamp.format>yyyyMMddHHmm</maven.build.timestamp.format>
        <cloudhub.uri>https://cloudhub.io</cloudhub.uri>
        <cloudhub.domain>testCloudhubPlugin${maven.build.timestamp}</cloudhub.domain>
    </properties>
    <dependencies>
        <!-- Maven Plugin Dependencies -->
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-settings</artifactId>
            <version>3.0.4</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>${maven.plugin.api.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-artifact</artifactId>
            <version>${maven.artifact.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-annotations</artifactId>
            <version>${maven.plugin.annotations.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-utils</artifactId>
            <version>${plexus.utils.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-project</artifactId>
            <version>${mave.project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.plugin-testing</groupId>
            <artifactId>maven-plugin-testing-harness</artifactId>
            <scope>test</scope>
            <version>${maven.plugin.api.version}</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-archiver</artifactId>
            <version>${codehaus.plexus.archiver}</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-core</artifactId>
            <version>${hamcrest.version}</version>
        </dependency>
        <dependency>
            <groupId>com.jayway.awaitility</groupId>
            <artifactId>awaitility</artifactId>
            <version>${awaitility.version}</version>
        </dependency>
        <!-- Other Dependencies -->
        <dependency>
            <groupId>org.mule</groupId>
            <artifactId>mule-core</artifactId>
            <version>${mule.core.version}</version>
            <classifier>tests</classifier>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-module-junit4</artifactId>
            <version>${powermock.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-api-mockito</artifactId>
            <version>${powermock.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.mulesoft.cloudhub</groupId>
            <artifactId>cloudhub-client-api</artifactId>
            <version>${cloudhub.client.version}</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-all</artifactId>
            <version>2.0.1</version>
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <id>mule</id>
            <name>Mule Releases</name>
            <url>https://repository.mulesoft.org/nexus/content/repositories/releases</url>
        </repository>
        <repository>
            <id>mule-snapshots</id>
            <name>Mule Snapshots</name>
            <url>https://repository.mulesoft.org/nexus/content/repositories/snapshots</url>
        </repository>
    </repositories>
    <distributionManagement>
        <repository>
            <id>mule-releases</id>
            <name>Mule Release Repository</name>
            <url>https://repository-master.mulesoft.org/nexus/content/repositories/releases</url>
        </repository>
        <snapshotRepository>
            <id>mule-snapshots</id>
            <name>Mule Snapshot Repository</name>
            <url>https://repository-master.mulesoft.org/nexus/content/repositories/snapshots</url>
            <uniqueVersion>false</uniqueVersion>
        </snapshotRepository>
    </distributionManagement>
    <scm>
        <connection>scm:git:git://github.com/mulesoft/cloudhub-maven-plugin.git</connection>
        <developerConnection>scm:git:git@github.com:mulesoft/cloudhub-maven-plugin.git</developerConnection>
        <url>http://github.com/mulesoft/cloudhub-maven-plugin</url>
    </scm>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>${enforcer.plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireProperty>
                                    <property>cloudhub.username</property>
                                    <message>You must set cloudhub.username system property</message>
                                </requireProperty>
                                <requireProperty>
                                    <property>cloudhub.password</property>
                                    <message>You must set cloudhub.password system property</message>
                                </requireProperty>
                            </rules>
                            <fail>true</fail>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.plugin.version}</version>
                <configuration>
                    <source>${java.source}</source>
                    <target>${java.target}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <version>${maven.plugin.plugin.version}</version>
                <configuration>
                    <goalPrefix>cloudhub</goalPrefix>
                    <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>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <version>${maven.plugin.plugin.version}</version>
            </plugin>
            <plugin>
                <!--Workaround for https://jira.codehaus.org/browse/MPIR-251-->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>${project.info.plugin.version}</version>
                <configuration>
                    <dependencyDetailsEnabled>false</dependencyDetailsEnabled>
                    <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
                </configuration>
            </plugin>
        </plugins>
    </reporting>

    <profiles>
        <profile>
            <id>run-its</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <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>
                            <addTestClassPath>true</addTestClassPath>
                            <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
                            <postBuildHookScript>verify</postBuildHookScript>
                            <invokerPropertiesFile>invoker.properties</invokerPropertiesFile>
                            <settingsFile>src/it/settings.xml</settingsFile>
                            <properties>
                                <cloudhub.domain>${cloudhub.domain}</cloudhub.domain>
                                <cloudhub.username>${cloudhub.username}</cloudhub.username>
                                <cloudhub.password>${cloudhub.password}</cloudhub.password>
                            </properties>
                            <scriptVariables>
                                <domain>${cloudhub.domain}</domain>
                                <uri>${cloudhub.uri}</uri>
                            </scriptVariables>
                            <goals>
                                <goal>clean</goal>
                                <goal>verify</goal>
                            </goals>
                        </configuration>
                        <executions>
                            <execution>
                                <id>integration-test</id>
                                <phase>integration-test</phase>
                                <goals>
                                    <goal>install</goal>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <version>${failsafe.plugin.version}</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
