<?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">
    <artifactId>jira-software-plugin</artifactId>
    <description>Provides software development features for Jira.</description>
    <modelVersion>4.0.0</modelVersion>
    <name>Jira for Software Plugin</name>
    <packaging>atlassian-plugin</packaging>

    <parent>
        <artifactId>jira-for-software-parent</artifactId>
        <groupId>com.atlassian.jira.plugins</groupId>
        <version>9.9.2</version>
    </parent>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.7</version>
                <executions>
                    <execution>
                        <configuration>
                            <target>
                                <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="maven.plugin.classpath" />
                                <if>
                                    <available file="${project.build.directory}/classes/projecttemplates/wfb/Software-Development-Workflow" type="dir" />
                                    <then>
                                        <zip destfile="${project.build.directory}/classes/projecttemplates/wfb/Software-Development-Workflow.jwb" basedir="${project.build.directory}/classes/projecttemplates/wfb/Software-Development-Workflow" update="true" />
                                        <delete dir="${project.build.directory}/classes/projecttemplates/wfb/Software-Development-Workflow" />
                                    </then>
                                </if>
                            </target>
                        </configuration>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.ant</groupId>
                        <artifactId>ant</artifactId>
                        <version>1.7.1</version>
                    </dependency>
                    <dependency>
                        <groupId>ant-contrib</groupId>
                        <artifactId>ant-contrib</artifactId>
                        <version>1.0b3</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.4</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                        <configuration>
                            <forceCreation>true</forceCreation>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>jira-maven-plugin</artifactId>
                <configuration>
                    <processI18nUsage>false</processI18nUsage>
                    <applications>
                        <application>
                            <applicationKey>jira-software</applicationKey>
                            <version>${jira.software.application.version}</version>
                        </application>
                    </applications>
                    <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-projects-plugin</artifactId>
                            <version>${jira.projects.version}</version>
                        </pluginArtifact>
                    </pluginArtifacts>
                    <instructions>
                        <Atlassian-Plugin-Key>${project.groupId}.${project.artifactId}</Atlassian-Plugin-Key>
                        <Export-Package>
                            com.atlassian.jira.software.api.*,
                            com.atlassian.jira.software.internal.obr.install
                        </Export-Package>
                        <Import-Package>
                            *;resolution:=optional,
                            com.atlassian.jira.blueprint.api*;version="[2,10)",
                            com.atlassian.jira.projects.api.sidebar.*,
                            com.atlassian.jira.projects.api.context.*,
                            com.atlassian.jira.plugin.webfragment.conditions
                        </Import-Package>
                        <Spring-Context>*</Spring-Context>
                    </instructions>
                    <skipManifestValidation>true</skipManifestValidation>
                    <extractDependencies>false</extractDependencies>
                    <systemPropertyVariables>
                        <atlassian.test.target.dir>${project.build.directory}/test-screenshots</atlassian.test.target.dir>
                        <xvfb.enable>${xvfb.enable}</xvfb.enable>
                    </systemPropertyVariables>

                    <jvmArgs>${jvmOpens} -Xmx1536m ${jira.jvm.args}</jvmArgs>

                    <buildTestPlugin>false</buildTestPlugin>
                    <testGroups>
                        <testGroup>
                            <id>base</id>
                            <productIds>
                                <productId>jira</productId>
                            </productIds>
                            <excludes>
                                <exclude>it/**/setup/**</exclude>
                            </excludes>
                        </testGroup>
                    </testGroups>
                </configuration>
            </plugin>
            <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>
                        <!-- process-classes seems to be skipped if you are using scala
                             so perhaps use prepare-package -->
                        <phase>process-classes</phase>
                    </execution>
                </executions>
                <configuration>
                    <!-- Enable this to get build-time logging of annotations atlassian-spring-scanner-maven-plugin has noticed -->
                    <verbose>false</verbose>
                </configuration>
            </plugin>
        </plugins>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
            </testResource>
            <testResource>
                <directory>src/test/xml</directory>
                <targetPath>xml</targetPath>
            </testResource>
        </testResources>
    </build>

    <dependencies>
        <dependency>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.event</groupId>
            <artifactId>atlassian-event</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-tests</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira.plugins</groupId>
            <artifactId>jira-software-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira.plugins</groupId>
            <artifactId>jira-software-test</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira.plugins</groupId>
            <artifactId>project-templates-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-annotation</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-core</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>log4j</groupId>
                    <artifactId>log4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-common</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>${guava.version}</version>
        </dependency>
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>jsr311-api</artifactId>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-projects-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.json</groupId>
            <artifactId>atlassian-json-api</artifactId>
        </dependency>
        <dependency>
            <artifactId>soy-template-renderer-api</artifactId>
            <groupId>com.atlassian.soy</groupId>
            <scope>provided</scope>
        </dependency>

        <!-- Test -->
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>atlassian-jira-pageobjects</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-projects-page-objects</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.selenium</groupId>
            <artifactId>atlassian-pageobjects-elements</artifactId>
        </dependency>
        <!-- AT/SLAT test case annotations -->
        <dependency>
            <groupId>com.atlassian</groupId>
            <artifactId>atlassian-test-categories</artifactId>
            <version>0.5</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>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>${servlet-api-version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
            <version>${xerces.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>software-bundled-plugins</id>
            <properties>
                <skipUTs>true</skipUTs>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.atlassian.maven.plugins</groupId>
                        <artifactId>jira-maven-plugin</artifactId>
                        <configuration>
                            <processI18nUsage>false</processI18nUsage>
                            <applications>
                                <application>
                                    <applicationKey>jira-software</applicationKey>
                                    <version>${jira.software.application.version}</version>
                                </application>
                            </applications>
                            <pluginArtifacts>
                                <!--
                                    The following empty pluginArtifact was deliberately added to suppress any plugin
                                    overrides defined in the main build configuration. We do not want any overrides
                                    when running the Software bundled plugins build.
                                -->
                                <pluginArtifact />
                            </pluginArtifacts>
                            <productVersion>${jira.version}</productVersion>
                            <productDataVersion>${jira.version}</productDataVersion>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>ondemand-acceptance-tests</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.atlassian.maven.plugins</groupId>
                        <artifactId>jira-maven-plugin</artifactId>
                        <configuration>
                            <processI18nUsage>false</processI18nUsage>
                            <testGroups>
                                <testGroup>
                                    <id>runAcceptanceTests</id>
                                    <includes>
                                        <include>**/at/**</include>
                                    </includes>
                                    <excludes>
                                        <exclude>**/it/**</exclude>
                                    </excludes>
                                    <productIds>
                                        <productId>jira</productId>
                                    </productIds>
                                </testGroup>
                            </testGroups>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
            <properties>
                <skipUTs>true</skipUTs>
                <rest.doc.generation.skip>true</rest.doc.generation.skip>
                <od.testing.configuration>
                    use-maven,3.2
                    use-java,8
                </od.testing.configuration>
            </properties>
        </profile>
        <profile>
            <id>setup-test-batch-1</id>
            <activation>
                <property>
                    <name>setup-test-batch-1</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.atlassian.maven.plugins</groupId>
                        <artifactId>jira-maven-plugin</artifactId>
                        <configuration>
                            <processI18nUsage>false</processI18nUsage>
                            <testGroups>
                                <testGroup>
                                    <id>base</id>
                                </testGroup>
                                <testGroup>
                                    <id>post-setup</id>
                                    <productIds>
                                        <productId>jira</productId>
                                    </productIds>
                                    <includes>
                                        <include>it/**/TestPostSetupStep.java</include>
                                    </includes>
                                </testGroup>
                            </testGroups>
                            <configuredTestGroupsToRun>post-setup</configuredTestGroupsToRun>
                            <productDataPath>${project.basedir}/initial-data/jira-not-set-up.zip</productDataPath>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
