<?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.jira.plugins</groupId>
        <artifactId>jira-transition-triggers-parent</artifactId>
        <version>9.7.2</version>
    </parent>

    <artifactId>jira-transition-triggers-plugin</artifactId>
    <packaging>atlassian-plugin</packaging>

    <name>Atlassian Jira - Plugins - Transition Trigger Plugin</name>
    <description>Allows defining transition triggers</description>

    <properties>
        <atlassian.plugin.key>com.atlassian.jira.plugins.jira-transition-triggers-plugin</atlassian.plugin.key>
        <generated.locale.dir>${project.build.directory}/generated-sources/pseudo-loc</generated.locale.dir>
        <jira.devmode>true</jira.devmode> <!-- use -DnoDevMode to disable -->
        <skip.surefire.tests>${skipTests}</skip.surefire.tests>
        <qunit.hack>false</qunit.hack>
        <baseurl.jira>http://${local.ip}:2990/jira</baseurl.jira>
        <context.jira.path>/jira</context.jira.path>
        <http.jira.port>2990</http.jira.port>
        <jira.host>${local.ip}</jira.host>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.atlassian.analytics</groupId>
            <artifactId>analytics-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.activeobjects</groupId>
            <artifactId>activeobjects-plugin</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-rest-plugin</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira.plugins</groupId>
            <artifactId>jira-transition-triggers-api</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-annotation</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-common</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-osgi</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Test -->
        <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>org.hamcrest</groupId>
            <artifactId>hamcrest-library</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-all</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-tests</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-func-tests</artifactId>
            <version>${jira.version.force}</version>
            <scope>test</scope>
            <exclusions>
                <!--exclude versions of commons-lang other than 3-->
                <exclusion>
                    <groupId>org.apache.commons</groupId>
                    <artifactId>commons-lang</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-nimble-func-tests</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>ka-func-test-framework</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira.tests</groupId>
            <artifactId>jira-testkit-client</artifactId>
            <version>${testkit.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.ibm.icu</groupId>
                    <artifactId>icu4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.atlassian.qunit</groupId>
            <artifactId>atlassian-qunit-plugin-util</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>atlassian-jira-pageobjects</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <artifactId>atlassian-browsers-auto</artifactId>
                    <groupId>com.atlassian.browsers</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>io.atlassian.util.concurrent</groupId>
            <artifactId>atlassian-util-concurrent</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>dom4j</groupId>
            <artifactId>dom4j</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- QueryDSL -->
        <dependency>
            <groupId>com.atlassian.pocketknife</groupId>
            <artifactId>atlassian-pocketknife-querydsl</artifactId>
            <exclusions>
                <!-- Must exclude findbugs jsr305 as already provided elsewhere.
                Inclusion will change scope from provided to compile, causing
                2 functional tests to fail. -->
                <exclusion>
                    <groupId>com.google.code.findbugs</groupId>
                    <artifactId>jsr305</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.atlassian.pocketknife</groupId>
            <artifactId>atlassian-pocketknife-querydsl-test-util</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-core</artifactId>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>log4j</groupId>
                    <artifactId>log4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.atlassian.browsers</groupId>
            <artifactId>firefox-profile</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.browsers</groupId>
            <artifactId>atlassian-browsers-auto</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
                <includes>
                    <include>localtest.properties</include>
                    <include>**/ctk/**</include>
                    <include>**/contracts/**</include>
                    <include>com/**</include>
                </includes>
                <filtering>true</filtering>
            </testResource>
            <testResource>
                <directory>src/test/xml</directory>
                <targetPath>xml</targetPath>
            </testResource>
        </testResources>
        <plugins>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.8.2</version>
                <configuration>
                    <destFile>${project.build.directory}/jacoco.exec</destFile>
                    <outputDirectory>${project.reporting.outputDirectory}/jacoco</outputDirectory>
                    <propertyName>surefire.argLine</propertyName>
                    <includes>
                        <include>com/atlassian/**/*</include>
                    </includes>
                </configuration>
                <executions>
                    <execution>
                        <id>pre-unit-test</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                </executions>
            </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>process-classes</phase>
                    </execution>
                </executions>
                <configuration>
                    <scannedDependencies>
                        <dependency>
                            <groupId>com.atlassian.pocketknife</groupId>
                            <artifactId>atlassian-pocketknife-querydsl</artifactId>
                        </dependency>
                    </scannedDependencies>
                </configuration>
            </plugin>
            <!-- Build test JAR for AT/SLAT execution -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                        <configuration>
                            <forceCreation>true</forceCreation>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.twdata.maven</groupId>
                <artifactId>maven-cli-plugin</artifactId>
                <version>1.0.10</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <includes>
                        <include>com/atlassian/jira/plugin/triggers/**</include>
                    </includes>
                    <excludes>
                        <exclude>%regex[it[/\\].*]</exclude>
                        <exclude>**/*$*</exclude>
                    </excludes>
                    <argLine>${jvmOpens} ${surefire.argLine}</argLine>
                    <skipTests>${skip.surefire.tests}</skipTests>
                    <systemPropertyVariables>
                        <atlassian.test.target.dir>${project.build.directory}</atlassian.test.target.dir>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>${plugin.buildhelper.version}</version>
                <executions>
                    <execution>
                        <phase>initialize</phase>
                        <id>get-local-ip</id>
                        <goals>
                            <goal>local-ip</goal>
                        </goals>
                        <configuration>
                            <localIpProperty>local.ip</localIpProperty>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>${plugin.docker.version}</version>
                <executions>
                    <execution>
                        <id>start</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                            <goal>start</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>stop</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <skip>${skipTests}</skip>
                    <images>
                        <image>
                            <alias>selenium</alias>
                            <name>selenium/standalone-firefox-debug:3.8.1</name>
                            <run>
                                <namingStrategy>alias</namingStrategy>
                                <!-- 2.0GB -->
                                <shmSize>2147483648</shmSize>
                                <log>
                                    <prefix>DOCKER (%a):</prefix>
                                    <color>cyan</color>
                                </log>
                                <ports>
                                    <port>5900:5900</port>
                                    <port>4444:4444</port>
                                </ports>
                                <wait>
                                    <log>screen setup finished.</log>
                                    <time>30000</time>
                                    <exec>
                                        <postStart>sleep 3s</postStart>
                                    </exec>
                                </wait>
                            </run>
                        </image>
                    </images>
                </configuration>
            </plugin>


            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>jira-maven-plugin</artifactId>
                <version>${amps.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <processI18nUsage>false</processI18nUsage>
                    <skipBanningDependencies>true</skipBanningDependencies>
                    <closureJsCompiler>false</closureJsCompiler>
                    <enableDevToolbox>false</enableDevToolbox>
                    <systemPropertyVariables>
                        <atlassian.dev.mode>${jira.devmode}</atlassian.dev.mode>
                        <jira.websudo.is.disabled>true</jira.websudo.is.disabled>
                        <atlassian.mail.senddisabled>true</atlassian.mail.senddisabled>
                        <atlassian.mail.fetchdisabled>true</atlassian.mail.fetchdisabled>
                        <skipI18nTransformation>${qunit.hack}</skipI18nTransformation>
                        <jira.qunit.testoutput.location>${project.build.directory}/surefire-reports</jira.qunit.testoutput.location>
                        <xvfb.enable>true</xvfb.enable>
                        <atlassian.test.target.dir>${project.build.directory}</atlassian.test.target.dir>
                        <user.language>en</user.language>
                        <user.country>US</user.country>
                    </systemPropertyVariables>
                    <productVersion>${jira.version.force}</productVersion>
                    <productDataVersion>${jira.data.version}</productDataVersion>
                    <enablePde>false</enablePde>
                    <skipRestDocGeneration>true</skipRestDocGeneration>
                    <allowGoogleTracking>false</allowGoogleTracking>
                    <extractDependencies>false</extractDependencies>
                    <applications>
                        <application>
                            <applicationKey>jira-software</applicationKey>
                            <version>${jira.software.application.version.force}</version>
                        </application>
                    </applications>
                    <pluginArtifacts>
                        <!-- test plugins -->
                        <pluginArtifact>
                            <groupId>com.atlassian.qunit</groupId>
                            <artifactId>atlassian-qunit-plugin</artifactId>
                        </pluginArtifact>
                        <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.force}</version>
                        </pluginArtifact>
                        <pluginArtifact>
                            <groupId>com.atlassian.jira.plugins</groupId>
                            <artifactId>jira-sample-transition-triggers-plugin</artifactId>
                            <version>${project.version}</version>
                        </pluginArtifact>

                        <!-- software plugins -->
                        <pluginArtifact>
                            <groupId>com.atlassian.jira.plugins</groupId>
                            <artifactId>jira-bamboo-plugin</artifactId>
                            <version>${project.version}</version>
                        </pluginArtifact>
                        <pluginArtifact>
                            <groupId>com.atlassian.jira.plugins</groupId>
                            <artifactId>jira-dvcs-connector-plugin</artifactId>
                            <version>${dvcs.version}</version>
                        </pluginArtifact>
                        <pluginArtifact>
                            <groupId>com.atlassian.jira.plugins</groupId>
                            <artifactId>jira-development-integration-plugin</artifactId>
                            <version>${dev.status.version}</version>
                        </pluginArtifact>
                        <pluginArtifact>
                            <groupId>com.atlassian.jira.plugins</groupId>
                            <artifactId>jira-fisheye-plugin</artifactId>
                            <version>${jira.fisheye.version}</version>
                        </pluginArtifact>
                        <pluginArtifact>
                            <groupId>com.atlassian.jira.plugins</groupId>
                            <artifactId>jira-greenhopper-plugin</artifactId>
                            <version>${project.version}</version>
                        </pluginArtifact>
                        <pluginArtifact>
                            <groupId>com.atlassian.jira.plugins</groupId>
                            <artifactId>jira-software-plugin</artifactId>
                            <version>${project.version}</version>
                        </pluginArtifact>
                    </pluginArtifacts>
                    <instructions>
                        <Private-Package>
                            com.atlassian.jira.plugin.triggers.impl*,
                            com.atlassian.jira.plugin.triggers.rest*,
                            com.atlassian.jira.plugin.triggers.web*,
                        </Private-Package>

                        <Import-Package>
                            com.atlassian.plugin.osgi.bridge.external,
                            javax.inject,
                            *;resolution:=optional<!--The "resolution:=optional" approach isn't exactly the ideal way of doing this,
                            if you need something that is exported by another package, and it isn't available in Jira
                             as an OSGi bundle, it will fail when it invokes the code that uses it, rather than at plugin start-time
                             (if we'd specified all of the packages to import explicitly here).
                             Getting all the correct imports is probably something worthwhile, but it's reasonably time intensive.
                              I resorted to this approach after running into tonnes of packages that were "required" by BND,
                              but actually weren't required from OSGi at runtime, because they were compile-time dependencies -->
                        </Import-Package>
                        <Export-Package>
                            com.atlassian.jira.plugin.triggers.api*,
                            com.atlassian.jira.plugin.triggers.privateapi,
                            com.atlassian.jira.plugin.triggers.obr.install
                        </Export-Package>
                        <Spring-Context>*</Spring-Context>
                        <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
                        <Bundle-SymbolicName>${atlassian.plugin.key}</Bundle-SymbolicName>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <!-- this profile existing only because system properties backdoor doesn't work in Jira 8.0 as of now -->
            <id>qunit-hack</id>
            <properties>
                <qunit.hack>true</qunit.hack>
            </properties>
        </profile>
        <profile>
            <id>runTestSuite</id>
            <activation>
                <property>
                    <name>testGroups</name>
                </property>
            </activation>
            <build>
                <testResources>
                    <testResource>
                        <directory>src/test/xml</directory>
                        <targetPath>xml</targetPath>
                    </testResource>
                </testResources>
                <plugins>
                    <plugin>
                        <groupId>com.atlassian.maven.plugins</groupId>
                        <artifactId>jira-maven-plugin</artifactId>
                        <configuration>
                            <processI18nUsage>false</processI18nUsage>
                            <systemPropertyVariables>
                                <atlassian.dev.mode>${jira.devmode}</atlassian.dev.mode>
                                <xvfb.enable>true</xvfb.enable>
                                <xvfb.display>:20</xvfb.display>
                                <jira.websudo.is.disabled>true</jira.websudo.is.disabled>
                                <atlassian.mail.senddisabled>true</atlassian.mail.senddisabled>
                                <atlassian.mail.fetchdisabled>true</atlassian.mail.fetchdisabled>
                                <jira.devstatus.oauth.3lo.disabled>true</jira.devstatus.oauth.3lo.disabled>
                                <skipI18nTransformation>${qunit.hack}</skipI18nTransformation>
                                <user.timezone>Australia/Brisbane</user.timezone>
                            </systemPropertyVariables>
                            <products>
                                <product>
                                    <id>jira</id>
                                    <version>${jira.version.force}</version>
                                    <dataVersion>${jira.data.version}</dataVersion>
                                </product>
                            </products>

                            <testGroups>
                                <testGroup>
                                    <id>QUnit</id>
                                    <includes>
                                        <include>it/com/atlassian/jira/plugin/triggers/qunit/*</include>
                                    </includes>
                                    <productIds>
                                        <productId>jira</productId>
                                    </productIds>
                                </testGroup>

                                <testGroup>
                                    <id>FuncTest</id>
                                    <includes>
                                        <include>it/com/atlassian/jira/plugin/triggers/functest/**</include>
                                    </includes>
                                    <productIds>
                                        <productId>jira</productId>
                                    </productIds>
                                </testGroup>

                                <testGroup>
                                    <id>Webdriver</id>
                                    <includes>
                                        <include>it/com/atlassian/jira/plugin/triggers/webdriver/**</include>
                                    </includes>
                                    <productIds>
                                        <productId>jira</productId>
                                    </productIds>
                                </testGroup>
                            </testGroups>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <configuration>
                            <systemPropertyVariables>
                                <!--suppress MavenModelInspection -->
                                <webdriver.browser>${webdriver.browser}</webdriver.browser>
                                <!--suppress MavenModelInspection -->
                                <baseurl.jira>${baseurl.jira}</baseurl.jira>
                                <!--suppress MavenModelInspection -->
                                <http.jira.port>${http.jira.port}</http.jira.port>
                                <!--suppress MavenModelInspection -->
                                <context.jira.path>${context.jira.path}</context.jira.path>
                                <!--suppress MavenModelInspection -->
                                <jira.host>${jira.host}</jira.host>
                                <atlassian.test.target.dir>${project.build.directory}/webdriverTests</atlassian.test.target.dir>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
    <reporting>
        <excludeDefaults>true</excludeDefaults>
        <plugins>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <reportSets>
                    <reportSet>
                        <reports>
                            <!-- select non-aggregate reports -->
                            <report>report</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
        </plugins>
    </reporting>
</project>
