<?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>com.atlassian.confluence.plugins</groupId>
        <artifactId>confluence-jira-metadata-project</artifactId>
        <version>4.0.0</version>
    </parent>

    <groupId>com.atlassian.confluence.plugins</groupId>
    <artifactId>confluence-jira-metadata</artifactId>
    <packaging>atlassian-plugin</packaging>

    <name>Confluence Jira Metadata Plugin</name>
    <description>Adds metadata information from Jira on the Page Metadata Banner</description>

    <dependencies>
        <dependency>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-annotation</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>confluence</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>confluence-java-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-common</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-nav-links-api</artifactId>
            <version>${navlinks.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>${javax.servlet.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence.plugins</groupId>
            <artifactId>confluence-create-content-plugin</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence.plugins</groupId>
            <artifactId>confluence-feature-discovery-plugin</artifactId>
            <version>${feature.discovery.plugin.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>issue-status-plugin</artifactId>
            <version>${issue.status.plugin.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-whitelist-api-plugin</artifactId>
            <version>${whitelist.version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- Dependencies for testing-->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>confluence-test-support</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>confluence-webdriver-support</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>atlassian-confluence-pageobjects</artifactId>
            <version>${confluence.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira.plugins</groupId>
            <artifactId>atlassian-jira-rpc-plugin</artifactId>
            <version>${atlassian-jira-rpc-plugin.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.connector</groupId>
            <artifactId>atlassian-connector-commons</artifactId>
            <version>4.0.0-mc2</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>amps-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Atlassian-Plugin-Key>${project.groupId}.${project.artifactId}</Atlassian-Plugin-Key>
                        <Require-Bundle>
                            com.atlassian.plugins.issue-status-plugin;bundle-version=${issue.status.plugin.version}
                        </Require-Bundle>
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.atlassian.plugin</groupId>
                <artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
                <version>${atlassian-spring-scanner-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>atlassian-spring-scanner</goal>
                        </goals>
                        <configuration>
                            <verbose>true</verbose>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <verbose>true</verbose>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <id>test-jar</id>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>flaky</id>
            <properties>
                <ci.tests.skipAfterFailureCount>10</ci.tests.skipAfterFailureCount>
                <ci.tests.rerunFailingTestsCount>2</ci.tests.rerunFailingTestsCount>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.googlecode.maven-download-plugin</groupId>
                        <artifactId>download-maven-plugin</artifactId>
                        <version>1.3.0</version>
                        <executions>
                            <execution>
                                <id>download-flaky-configuration</id>
                                <phase>process-test-resources</phase>
                                <goals>
                                    <goal>wget</goal>
                                </goals>
                                <configuration>
                                    <url>https://s3-ap-southeast-2.amazonaws.com/confluence-server/bamboo/issuecreator_plugins_config.json</url>
                                    <outputDirectory>${project.build.testOutputDirectory}</outputDirectory>
                                    <overwrite>true</overwrite>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <configuration>
                            <skipAfterFailureCount>${ci.tests.skipAfterFailureCount}</skipAfterFailureCount>
                            <rerunFailingTestsCount>${ci.tests.rerunFailingTestsCount}</rerunFailingTestsCount>
                            <properties>
                                <property>
                                    <name>listener</name>
                                    <value>com.atlassian.test.reporting.JUnitFlakyTestListener</value>
                                </property>
                            </properties>
                            <systemPropertyVariables>
                                <junitflakylistener.runnerId>${env.bamboo_buildResultKey}</junitflakylistener.runnerId>
                                <junitflakylistener.branchName>${env.bamboo_planRepository_1_branchName}</junitflakylistener.branchName>
                                <!-- issue creation kill switch; by default, issues will be created on branch builds as well -->
                                <junitflakylistener.trackFlakyTest>true</junitflakylistener.trackFlakyTest>
                                <junitflakylistener.flakyTestFilePath>target/failsafe-reports/flakey-tests.txt</junitflakylistener.flakyTestFilePath>
                                <junitflakylistener.jiraProjectConfigPath>issuecreator_plugins_config.json</junitflakylistener.jiraProjectConfigPath>
                                <junitflakylistener.jiraUserName>${env.bamboo_issuecreator_jiraUserName}</junitflakylistener.jiraUserName>
                                <junitflakylistener.jiraPassword>${env.bamboo_issuecreator_jiraPassword}</junitflakylistener.jiraPassword>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
            <dependencies>
                <dependency>
                    <groupId>com.atlassian</groupId>
                    <artifactId>flaky-test-reporter</artifactId>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>com.googlecode.maven-download-plugin</groupId>
                    <artifactId>download-maven-plugin</artifactId>
                    <version>1.3.0</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>
    </profiles>
</project>
