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

    <parent>
        <groupId>com.atlassian.jira.plugins</groupId>
        <artifactId>project-templates-parent</artifactId>
        <version>6.2.0</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>project-templates-plugin</artifactId>

    <name>Project Templates Plugin</name>
    <description>This is the Project Templates Plugin for Atlassian JIRA.</description>
    <packaging>atlassian-plugin</packaging>

    <properties>
        <enforcer.skip>true</enforcer.skip>
        <skipITs>true</skipITs> <!-- skip integration tests by default -->
        <xvfb.enable>false</xvfb.enable>
        <od.testing.configuration>
            use-maven,3.2.5
            use-java,8
            include-artifact,com.atlassian.jira.plugins:project-templates-acceptance-tests
        </od.testing.configuration>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.atlassian.jira.plugins</groupId>
            <artifactId>project-templates-api</artifactId>
            <version>${project.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-api</artifactId>
            <version>${jira.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-core</artifactId>
            <version>${plugins.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira.plugins.workflow.sharing</groupId>
            <artifactId>jira-workflow-sharing-plugin</artifactId>
            <version>${jira.workflow.importer.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>atlassian-jira-pageobjects</artifactId>
            <version>${jira.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-simple</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira.plugins</groupId>
            <artifactId>project-templates-pageobjects</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>${slf4j.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>${httpcore.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.applinks</groupId>
            <artifactId>applinks-api</artifactId>
            <version>3.2</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.activeobjects</groupId>
            <artifactId>activeobjects-plugin</artifactId>
            <version>${ao.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.util.concurrent</groupId>
            <artifactId>atlassian-util-concurrent</artifactId>
            <version>${atlassian.concurrent.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-common</artifactId>
            <version>${jira.rest.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-rest-plugin</artifactId>
            <version>${jira.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.10</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-nimble-func-tests</artifactId>
            <version>0.2.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-func-tests</artifactId>
            <version>${jira.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-func-tests-legacy</artifactId>
            <version>${jira.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira.tests</groupId>
            <artifactId>jira-testkit-client</artifactId>
            <version>${testkit.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>com.ibm.icu</groupId>
                    <artifactId>icu4j</artifactId>
                </exclusion>
            </exclusions>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>${gson.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.qunit</groupId>
            <artifactId>atlassian-qunit-plugin-util</artifactId>
            <version>${atlassian.qunit.plugin.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.pocketknife</groupId>
            <artifactId>atlassian-pocketknife-querydsl</artifactId>
            <version>${pocketknife.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.pocketknife</groupId>
            <artifactId>atlassian-pocketknife-querydsl-test-util</artifactId>
            <version>${pocketknife.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>1.3.164</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- spring scanner -->
        <dependency>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-annotation</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-runtime</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.json</groupId>
            <artifactId>atlassian-json-api</artifactId>
            <version>${atlassian.json.version}</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <testResources>
            <testResource>
                <directory>src/test/xml</directory>
                <targetPath>xml</targetPath>
            </testResource>
            <testResource>
                <directory>src/test/resources</directory>
            </testResource>
        </testResources>

        <plugins>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-jira-plugin</artifactId>
                <version>${amps.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <productVersion>${jira.version}</productVersion>
                    <productDataVersion>${jira.version}</productDataVersion>
                    <instructions>
                        <Export-Package>
                            com.atlassian.jira.blueprint.api,
                            com.atlassian.jira.projecttemplates,
                            com.atlassian.jira.projecttemplates.service,
                            com.atlassian.jira.projecttemplates.model
                        </Export-Package>
                        <Private-Package />
                    </instructions>
                    <pluginArtifacts>
                        <pluginArtifact>
                            <groupId>com.atlassian.jira.tests</groupId>
                            <artifactId>jira-testkit-plugin</artifactId>
                            <version>${testkit.version}</version>
                        </pluginArtifact>
                        <pluginArtifact>
                            <groupId>com.atlassian.jira</groupId>
                            <artifactId>jira-func-test-plugin</artifactId>
                            <version>${jira.version}</version>
                        </pluginArtifact>
                        <pluginArtifact>
                            <groupId>com.atlassian.jira.plugins</groupId>
                            <artifactId>jira-core-project-templates</artifactId>
                            <version>${project.version}</version>
                        </pluginArtifact>
                        <pluginArtifact>
                            <groupId>com.atlassian.qunit</groupId>
                            <artifactId>atlassian-qunit-plugin</artifactId>
                            <version>${atlassian.qunit.plugin.version}</version>
                        </pluginArtifact>
                    </pluginArtifacts>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <argLine>-Xmx512m -Dfile.encoding=ISO-8859-1 -Duser.language=en -Duser.region=AU</argLine>
                    <excludes>
                        <exclude>**/*$*</exclude>
                        <exclude>it/**</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.atlassian.plugin</groupId>
                <artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
                <version>${spring.scanner.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>atlassian-spring-scanner</goal>
                        </goals>
                        <phase>prepare-package</phase>
                        <!-- process-classes seems to be skipped for scala -->
                    </execution>
                </executions>
                <configuration>
                    <!-- Turn this on to true to show the inner workings of the build time scanner -->
                    <verbose>true</verbose>
                    <scannedDependencies>
                        <dependency>
                            <groupId>com.atlassian.pocketknife</groupId>
                            <artifactId>atlassian-pocketknife-querydsl</artifactId>
                        </dependency>
                    </scannedDependencies>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>run-integration-tests</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property>
                    <name>integrationTests</name>
                </property>
            </activation>
            <properties>
                <skipITs>false</skipITs>
            </properties>
            <build>
                <testResources>
                    <testResource>
                        <directory>src/test/xml</directory>
                        <targetPath>xml</targetPath>
                    </testResource>
                </testResources>
                <plugins>
                    <plugin>
                        <groupId>com.atlassian.maven.plugins</groupId>
                        <artifactId>maven-jira-plugin</artifactId>
                        <version>${amps.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <skipITs>${skipITs}</skipITs>
                            <systemPropertyVariables>
                                <xvfb.enable>${xvfb.enable}</xvfb.enable>
                                <jira.qunit.testoutput.location>${project.build.directory}/group-jpt-it-testgroup/tomcat6x/surefire-reports</jira.qunit.testoutput.location>
                                <atlassian.test.target.dir>${project.build.directory}/group-jpt-it-testgroup/tomcat6x/test-reports</atlassian.test.target.dir>
                            </systemPropertyVariables>
                            <pluginArtifacts>
                                <pluginArtifact>
                                    <groupId>com.atlassian.jira.tests</groupId>
                                    <artifactId>jira-testkit-plugin</artifactId>
                                    <version>${testkit.version}</version>
                                </pluginArtifact>
                                <pluginArtifact>
                                    <groupId>com.atlassian.jira</groupId>
                                    <artifactId>jira-func-test-plugin</artifactId>
                                    <version>${jira.version}</version>
                                </pluginArtifact>
                                <pluginArtifact>
                                    <groupId>com.atlassian.jira.plugins</groupId>
                                    <artifactId>jira-core-project-templates</artifactId>
                                    <version>${project.version}</version>
                                </pluginArtifact>
                                <pluginArtifact>
                                    <groupId>com.atlassian.jira.plugins</groupId>
                                    <artifactId>project-templates-samples</artifactId>
                                    <version>${project.version}</version>
                                </pluginArtifact>
                                <pluginArtifact>
                                    <groupId>com.atlassian.qunit</groupId>
                                    <artifactId>atlassian-qunit-plugin</artifactId>
                                    <version>${atlassian.qunit.plugin.version}</version>
                                </pluginArtifact>
                            </pluginArtifacts>
                            <products>
                                <product>
                                    <id>jira</id>
                                    <instanceId>jira</instanceId>
                                    <version>${jira.version}</version>
                                </product>
                            </products>
                            <testGroups>
                                <testGroup>
                                    <id>jpt-it-testgroup</id>
                                    <productIds>
                                        <productId>jira</productId>
                                    </productIds>
                                    <includes>
                                        <include>it/**/*Test.java</include>
                                        <include>it/**/Test*.java</include>
                                    </includes>
                                    <excludes>
                                        <exclude>**/BrowserTest.java</exclude>
                                    </excludes>
                                </testGroup>
                            </testGroups>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
