<?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.officeconnector</groupId>
        <artifactId>OfficeConnector-project</artifactId>
        <version>11.0.7</version>
    </parent>

    <artifactId>OfficeConnector</artifactId>
    <packaging>atlassian-plugin</packaging>

    <name>Office Connector confluence plugin</name>
    <url>http://www.atlassian.com/office</url>

    <properties>
        <atlassian.plugin.key>com.atlassian.confluence.extra.officeconnector</atlassian.plugin.key>
        <confluence.version>7.2.0</confluence.version>
        <powermock.version>2.0.4</powermock.version>
    </properties>

    <dependencies>
        <!-- Provided dependencies -->
        <dependency>
            <groupId>com.github.dblock</groupId>
            <artifactId>oshi-core</artifactId>
            <version>3.3</version>
        </dependency>
        <dependency>
            <groupId>net.java.dev.jna</groupId>
            <artifactId>jna-platform</artifactId>
            <version>4.2.2</version>
        </dependency>
        <dependency>
            <groupId>net.java.dev.jna</groupId>
            <artifactId>jna</artifactId>
            <version>4.2.2</version>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>document-conversion-library</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence.plugins</groupId>
            <artifactId>confluence-document-conversion-library</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>confluence</artifactId>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>net.sourceforge.nekohtml</groupId>
                    <artifactId>nekohtml</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>confluence-java-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-annotation</artifactId>
            <version>${atlassian.spring.scanner.version}</version>
            <scope>provided</scope>
        </dependency>
        <!-- Depend on the WebDAV Plugin in order to use the 'PluggableResourceFactory' module type (see CONF-18174) -->
        <dependency>
            <groupId>com.atlassian.confluence.extra.webdav</groupId>
            <artifactId>webdav-plugin</artifactId>
            <version>5.0.6</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>jcl104-over-slf4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.atlassian.confluence.plugins</groupId>
            <artifactId>analytics-jobs-plugin</artifactId>
            <version>${confluence.version}</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-common</artifactId>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.sun.jersey</groupId>
                    <artifactId>jersey-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- Plugin/Compile dependencies -->
        <dependency>
            <groupId>pdf-renderer</groupId>
            <artifactId>pdf-renderer</artifactId>
            <version>1.13-atlassian-8</version>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence.officeconnector</groupId>
            <artifactId>common</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence.officeconnector</groupId>
            <artifactId>OfficeConnector-canary</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence.officeconnector</groupId>
            <artifactId>extractor</artifactId>
            <version>${project.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>dom4j</groupId>
                    <artifactId>dom4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- For the Canary... -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-exec</artifactId>
            <version>1.3</version>
        </dependency>

        <!-- Test dependencies -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>axis</groupId>
            <artifactId>axis-jaxrpc</artifactId>
            <version>1.4</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence.plugin</groupId>
            <artifactId>func-test-package</artifactId>
            <version>${atlassian.product.test-lib.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>net.sourceforge.jwebunit</groupId>
                    <artifactId>jwebunit-htmlunit-plugin</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>confluence-test-support</artifactId>
            <version>${atlassian.product.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>xmlunit</groupId>
            <artifactId>xmlunit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-library</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <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-mockito2</artifactId>
            <version>${powermock.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>com.atlassian.plugin</groupId>
                <artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
                <version>${atlassian.spring.scanner.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>atlassian-spring-scanner</goal>
                        </goals>
                        <phase>process-classes</phase>
                    </execution>
                </executions>
                <configuration>
                    <verbose>false</verbose>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <!-- exclude licensing stuff and unfinished features -->
                    <excludes>
                        <exclude>com/benryan/export/**/*.java</exclude>
                        <exclude>com/benryan/license/LicenseFile.java</exclude>
                        <exclude>com/benryan/webwork/*Export*.java</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>confluence-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
                        <Spring-Context>*</Spring-Context>
                        <Import-Package>
                            <!-- exclude unused packages from third party libraries -->
                            !com.sun*,
                            !com.aspose.ms.System,
                            !electric.xml,
                            !org.gjt.xpp,
                            !magick,
                            !junit.framework,
                            !org.apache.crimson.jaxp,
                            !org.apache.tools*,
                            !org.apache.xml*,
                            !org.relaxng.datatype,
                            !org.slf4j.impl,
                            !org.jaxen.saxpath,
                            !org.xmlpull.v1,

                            <!-- atlassian-plugin.xml only, not directly referenced in java bytecode -->
                            com.atlassian.confluence.plugin.descriptor.web.conditions,
                            com.atlassian.confluence.plugin.descriptor.web.urlreadingconditions,
                            com.atlassian.confluence.setup.settings,

                            <!-- needed for parsing spring XML files -->
                            org.w3c.dom,
                            <!-- periodic analytics -->
                            com.atlassian.confluence.plugins.analytics.jobs.api,

                            <!-- we need (alltheotherthings) -->
                            *
                        </Import-Package>
                    </instructions>
                    <productVersion>${atlassian.product.version}</productVersion>
                    <productDataVersion>${atlassian.product.data.version}</productDataVersion>
                    <jvmArgs>${jvm.args}</jvmArgs>
                    <containerId>${containerId}</containerId>
                    <extractDependencies>false</extractDependencies>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-canary-jar-into-resources</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <stripVersion>true</stripVersion>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.atlassian.confluence.officeconnector</groupId>
                                    <artifactId>OfficeConnector-canary</artifactId>
                                    <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </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>${download.maven.plugin.version}</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>${download.maven.plugin.version}</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>
    </profiles>
</project>
