<?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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.atlassian.bamboo</groupId>
        <artifactId>atlassian-bamboo-plugins2-parent</artifactId>
        <version>6.0.0-m335</version>
        <!-- this should stay here until this module is moved under bamboo-plugins2 -->
        <relativePath>../../bamboo-plugins2/pom.xml</relativePath>
    </parent>

    <groupId>com.atlassian.bamboo.plugins</groupId>
    <artifactId>atlassian-bamboo-project-creation</artifactId>
    
    <name>Project Creation Plugin SPI for Bamboo</name>
    <description>SPI plugin for Atlassian Bamboo.</description>
    <packaging>atlassian-plugin</packaging>

    <dependencies>
        <dependency>
            <groupId>com.atlassian.bamboo</groupId>
            <artifactId>atlassian-bamboo-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-project-creation-spi</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>jsr311-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.atlassian.fugue</groupId>
            <artifactId>fugue</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.sal</groupId>
            <artifactId>sal-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-osgi-testrunner</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-project-creation-spi</artifactId>
            <classifier>acceptance-tests</classifier>
            <!-- if you intend to extend these tests intend of running them directly, use compile scope. -->
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.framework</artifactId>
            <version>3.0.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-project-creation-plugin</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>release-profile</id>
            <properties>
                <skipTests>true</skipTests>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <skip>true</skip>
                            <skipTests>true</skipTests>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <build>
        <plugins>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-bamboo-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <productVersion>${project.version}</productVersion>
                    <productDataVersion>5.3</productDataVersion>
                    <instructions><!--
                        <Atlassian-Plugin-Key>com.atlassian.bamboo.plugins.atlassian-bamboo-project-creation</Atlassian-Plugin-Key>-->
                        <Import-Package>
                            com.atlassian.bamboo*,
                            com.atlassian.fugue;version="[1.1,3)",
                            io.atlassian.fugue,
                            com.atlassian.plugins.projectcreate.spi,
                            com.atlassian.sal.api*,
                            com.google.common.base,
                            com.google.common.collect,
                            org.apache.commons.lang,
                            org.apache.commons.lang3,
                            javax.annotation,
                            javax.ws.rs.core
                        </Import-Package>
                    </instructions>
                    <bundledArtifacts>
                        <!-- atlassian-plugins-osgi-testrunner requires commons-io < 2.0 -->
                        <bundledArtifact>
                            <groupId>org.apache.servicemix.bundles</groupId>
                            <artifactId>org.apache.servicemix.bundles.commons-io</artifactId>
                            <version>1.4_3</version>
                        </bundledArtifact>
                    </bundledArtifacts>
                    <pluginArtifacts>
                        <pluginArtifact>
                            <groupId>com.atlassian.plugins</groupId>
                            <artifactId>atlassian-project-creation-plugin</artifactId>
                            <version>${atlassian.projectcreate.version}</version>
                        </pluginArtifact>
                    </pluginArtifacts>

                    <!-- so that yo don't end up with a huge tests.jar -->
                    <excludeAllTestDependencies>true</excludeAllTestDependencies>

                    <!-- so that the atlassian-plugin.xml defined in the spi acceptance-tests jar can be used. -->
                    <buildTestPlugin>true</buildTestPlugin>

                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${surefire.version}</version>
                <configuration>
                    <dependenciesToScan>
                        <dependency>com.atlassian.plugins:atlassian-project-creation-spi</dependency>
                    </dependenciesToScan>
                </configuration>
            </plugin>
            <!-- to run the tests from the acceptance-tests jar, we need to unpack them as we've excluded all test dependencies. -->
            <!-- only include **/*.xml and exclude **/*.class if your tests extend the tests from the acceptance-tests jar. -->
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-acceptance-tests</id>
                        <phase>process-test-classes</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.atlassian.plugins</groupId>
                                    <artifactId>atlassian-project-creation-spi</artifactId>
                                    <classifier>acceptance-tests</classifier>
                                    <version>${atlassian.projectcreate.version}</version>
                                </artifactItem>
                            </artifactItems>
                            <includes>it/**</includes>
                            <outputDirectory>${project.build.testOutputDirectory}</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
