<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</groupId>
        <artifactId>jira-plugins</artifactId>
        <version>7.4.0-RELEASE-SOKEBASE-63</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>jira-admin-project-config-plugin</artifactId>
    <packaging>atlassian-plugin</packaging>
    <name>Atlassian JIRA - Plugins - Project Config Plugin</name>

    <build>
        <finalName>${project.artifactId}-${project.version}</finalName>
        <resources>
            <resource>
                <directory>${min.resources}</directory>
                <filtering>false</filtering>
                <includes>
                    <include>**/*-min.js</include>
                    <include>**/*-min.css</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/atlassian-plugin.xml</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
                <excludes>
                    <exclude>**/atlassian-plugin.xml</exclude>
                </excludes>
            </resource>
        </resources>

        <plugins>
            <plugin>
                <groupId>com.atlassian.plugin</groupId>
                <artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-jira-plugin</artifactId>
                <version>${amps.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <enableDevToolbox>false</enableDevToolbox>
                    <enableFastdev>false</enableFastdev>
                    <skipITs>true</skipITs>
                    <extractDependencies>true</extractDependencies>
                    <instructions>
                        <Atlassian-Plugin-Key>${project.groupId}.jira-project-config-plugin</Atlassian-Plugin-Key>
                        <Spring-Context>*</Spring-Context>
                        <Export-Package>
                            com.atlassian.jira.projectconfig.util,
                            com.atlassian.jira.projectconfig.tab,
                            com.atlassian.jira.projectconfig.analytics
                        </Export-Package>
                        <Import-Package>
                            org.springframework.*,
                            org.osgi.framework.*,
                            org.w3c.dom,
                            com.atlassian.plugin.osgi.factory.*,
                            com.atlassian.sal.*,
                            com.atlassian.scheduler.*,
                            com.atlassian.jira.plugin.webfragment.conditions,
                            *
                        </Import-Package>
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>it/**</exclude>
                    </excludes>
                    <skip>${skipTests}</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>net.sf.alchim</groupId>
                <artifactId>yuicompressor-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>compress</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <linebreakpos>-1</linebreakpos>
                    <jswarn>false</jswarn>
                    <nomunge>true</nomunge>
                    <excludes>
                        <exclude>${min.resources}/**</exclude>
                        <exclude>**/*.xml</exclude>
                        <exclude>**/*-min*</exclude>
                        <exclude>**/*-test.js</exclude>
                        <exclude>**/*-tests.js</exclude>
                    </excludes>
                    <outputDirectory>${min.resources}</outputDirectory>
                </configuration>
            </plugin>
            <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>com.atlassian.lesscss</groupId>
                <artifactId>lesscss-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>compile-less</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
                <filtering>false</filtering>
            </testResource>
            <testResource>
                <directory>src/test/xml</directory>
                <filtering>false</filtering>
                <includes>
                    <include>*.xml</include>
                </includes>
                <targetPath>xml</targetPath>
            </testResource>
        </testResources>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.atlassian.lesscss</groupId>
                    <artifactId>lesscss-maven-plugin</artifactId>
                    <version>${atlassian.less.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                        <skipTests>${skipTests}</skipTests>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>com.atlassian.maven.plugins</groupId>
                    <artifactId>maven-amps-plugin</artifactId>
                    <version>${amps.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
    <dependencies>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-api</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-core</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>${servlet-api-version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-tests</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.templaterenderer</groupId>
            <artifactId>atlassian-template-renderer-api</artifactId>
            <version>${template.renderer.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>${log4j.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>jsr311-api</artifactId>
            <version>${jsr311.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-common</artifactId>
            <version>${rest.version}</version>
            <scope>provided</scope>
        </dependency>
        <!-- HACK: this should be pulled in by com.sun.jersey:jersey-server:jar:1.8-atlassian-6, but isn't. -->
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-core</artifactId>
            <version>${jersey.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-rest-api</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira.plugins</groupId>
            <artifactId>workflow-designer-plugin</artifactId>
            <version>${workflow.designer.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-annotation</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins.jstestrunner</groupId>
            <artifactId>atlassian-jstest-runner-pageobjects</artifactId>
            <version>${atlassian.jstest.runner.plugin.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>atlassian-jira-pageobjects</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-webdriver-tests</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
            <version>4.4.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient-cache</artifactId>
            <version>4.2.1-atlassian-2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.6</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>1.4</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.buildeng.hallelujah</groupId>
            <artifactId>server</artifactId>
            <version>${hallelujah.version}</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.sun.jersey</groupId>
                    <artifactId>jersey-grizzly</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-aop</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-web</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.atlassian.buildeng.hallelujah</groupId>
            <artifactId>client</artifactId>
            <version>${hallelujah.version}</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.sun.jersey</groupId>
                    <artifactId>jersey-grizzly</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>
    <profiles>
        <profile>
            <id>pseudo-loc</id>
            <build>
                <resources>
                    <resource>
                        <directory>${generated.locale.dir}</directory>
                    </resource>
                </resources>
                <plugins>
                    <plugin>
                        <groupId>com.atlassian.maven.plugins</groupId>
                        <artifactId>pseudo-loc-maven-plugin</artifactId>
                        <version>1.0</version>
                        <executions>
                            <execution>
                                <id>pseudo-loc</id>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>pseudo-loc</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <sourceLocale>en_UK</sourceLocale>
                            <targetLocale>en_AQ</targetLocale>
                            <pseudoLocaliseActions>
                                <pseudoLocaliseAction>
                                    <source>src/main/resources/jira-project-config-plugin.properties</source>
                                    <target>${generated.locale.dir}/jira-project-config-plugin_{loc}.properties</target>
                                </pseudoLocaliseAction>
                            </pseudoLocaliseActions>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <!-- Run only the project config QUnit test suite (e.g. `mvn3 clean verify -PrunTestSuite -DtestGroups=QUnit`). -->
        <profile>
            <id>runTestSuite</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.atlassian.maven.plugins</groupId>
                        <artifactId>maven-jira-plugin</artifactId>
                        <configuration>
                            <pluginArtifacts>
                                <pluginArtifact>
                                    <groupId>com.atlassian.jira</groupId>
                                    <artifactId>jira-func-test-plugin</artifactId>
                                    <version>${project.version}</version>
                                </pluginArtifact>
                                <pluginArtifact>
                                    <groupId>com.atlassian.jira.tests</groupId>
                                    <artifactId>jira-testkit-plugin</artifactId>
                                    <version>${testkit.version}</version>
                                </pluginArtifact>
                                <pluginArtifact>
                                    <groupId>com.atlassian.plugins.jstestrunner</groupId>
                                    <artifactId>atlassian-jstest-runner-plugin</artifactId>
                                    <version>${atlassian.jstest.runner.plugin.version}</version>
                                </pluginArtifact>
                            </pluginArtifacts>
                            <products>
                                <product>
                                    <id>jira</id>
                                    <version>${project.version}</version>
                                    <dataVersion>${project.version}</dataVersion>
                                </product>
                            </products>
                            <testGroups>
                                <testGroup>
                                    <id>QUnit</id>
                                    <includes>
                                        <include>**/it/com/atlassian/jira/projectconfig/qunit/**</include>
                                    </includes>
                                    <excludes>
                                        <!--
                                            It turned out that maven's profile does not define new testGroups. Instead it
                                            overwrites testGroup configuration defined above. If we won't define excludes for
                                            this group they will be copied from the "default" testGroup and test won't run.
                                        -->
                                        <exclude>**/it/com/atlassian/jira/projectconfig/func/webtests/**</exclude>
                                    </excludes>
                                    <productIds>
                                        <productId>jira</productId>
                                    </productIds>
                                </testGroup>
                                <testGroup>
                                    <id>Func</id>
                                    <includes>
                                        <include>**/it/com/atlassian/jira/projectconfig/func/webtests/**</include>
                                    </includes>
                                    <productIds>
                                        <productId>jira</productId>
                                    </productIds>
                                </testGroup>
                                <testGroup>
                                    <id>WebDriver</id>
                                    <includes>
                                        <include>**/it/com/atlassian/jira/projectconfig/webdriver/tests/**</include>
                                    </includes>
                                    <productIds>
                                        <productId>jira</productId>
                                    </productIds>
                                </testGroup>
                            </testGroups>
                            <systemPropertyVariables>
                                <xvfb.enable>${xvfb.enable}</xvfb.enable>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>hallelujahServer</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>1.1.1</version>
                        <executions>
                            <execution>
                                <phase>test</phase>
                                <goals>
                                    <goal>java</goal>
                                </goals>
                                <configuration>
                                    <mainClass>
                                        it.com.atlassian.jira.projectconfig.hallelujah.ProjectConfigHallelujahServer
                                    </mainClass>
                                    <classpathScope>test</classpathScope>
                                    <systemProperties>
                                        <systemProperty>
                                            <key>atlassian.test.suite.package</key>
                                            <value>${atlassian.test.suite.package}</value>
                                        </systemProperty>
                                        <systemProperty>
                                            <key>atlassian.test.suite.includes</key>
                                            <value>${atlassian.test.suite.includes}</value>
                                        </systemProperty>
                                        <systemProperty>
                                            <key>atlassian.test.suite.excludes</key>
                                            <value>${atlassian.test.suite.excludes}</value>
                                        </systemProperty>
                                        <systemProperty>
                                            <key>atlassian.test.run.only.quarantined</key>
                                            <value>${atlassian.test.run.only.quarantined}</value>
                                        </systemProperty>
                                        <systemProperty>
                                            <key>atlassian.test.target.dir</key>
                                            <value>${atlassian.test.target.dir}</value>
                                        </systemProperty>
                                        <systemProperty>
                                            <key>jira.functest.single.testclass</key>
                                            <value>${jira.functest.single.testclass}</value>
                                        </systemProperty>
                                        <systemProperty>
                                            <key>jira.hallelujah.queueId</key>
                                            <value>${jira.hallelujah.queueId}</value>
                                        </systemProperty>
                                        <systemProperty>
                                            <key>jira.qunit.testoutput.location</key>
                                            <value>${project.build.directory}/surefire-reports</value>
                                        </systemProperty>
                                    </systemProperties>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <properties>
                <skipTests>true</skipTests>
            </properties>
        </profile>
        <profile>
            <id>hallelujahClient</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.atlassian.maven.plugins</groupId>
                        <artifactId>maven-jira-plugin</artifactId>
                        <configuration>
                            <systemPropertyVariables>
                                <xvfb.enable>${xvfb.enable}</xvfb.enable>
                            </systemPropertyVariables>
                            <products>
                                <product>
                                    <id>jira</id>
                                    <version>${project.version}</version>
                                    <dataVersion>${project.version}</dataVersion>
                                </product>
                            </products>
                            <testGroups>
                                <testGroup>
                                    <id>hallelujahClient</id>
                                    <includes>
                                        <include>**/ProjectConfigHallelujahClient.java</include>
                                    </includes>
                                    <productIds>
                                        <productId>jira</productId>
                                    </productIds>
                                </testGroup>
                            </testGroups>
                            <systemProperties>
                                <property>
                                    <name>atlassian.test.target.dir</name>
                                    <value>${atlassian.test.target.dir}</value>
                                </property>
                            </systemProperties>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
            <properties>
                <testGroups>hallelujahClient</testGroups>
            </properties>
        </profile>
        <profile>
            <id>skipTests</id>
            <properties>
                <skipTests>true</skipTests>
            </properties>
        </profile>
        <profile>
            <id>ondemand-acceptance-tests</id>
            <properties>
                <skipTests>true</skipTests>
                <od.testing.configuration>
                    use-maven,3
                </od.testing.configuration>
            </properties>
        </profile>
    </profiles>
    <properties>
        <atlassian.test.run.only.quarantined>false</atlassian.test.run.only.quarantined>
        <atlassian.test.suite.excludes />
        <atlassian.test.suite.includes />
        <jira.functest.single.testclass />
        <jira.hallelujah.queueId />
        <atlassian.test.suite.package>it.com.atlassian.jira.projectconfig.webdriver.tests</atlassian.test.suite.package>
        <atlassian.test.target.dir>${project.build.directory}</atlassian.test.target.dir>

        <generated.locale.dir>${project.build.directory}/generated-sources/pseudo-loc</generated.locale.dir>
        <min.resources>${project.build.directory}/generated-resources/min</min.resources>
        <xvfb.enable>true</xvfb.enable>
        <easymock.version>2.5.2</easymock.version>
    </properties>
</project>
