<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">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.atlassian.jira</groupId>
        <artifactId>jira-rest</artifactId>
        <version>6.1.3</version>
    </parent>
    <artifactId>jira-rest-plugin</artifactId>
    <name>Atlassian JIRA - Plugins - REST Plugin</name>
    <description>Provides a REST interface for JIRA</description>
    <packaging>atlassian-plugin</packaging>
    <properties>
        <atlassian.plugin.key>com.atlassian.jira.rest</atlassian.plugin.key>
        <xsl.directory>${project.build.directory}/xsl</xsl.directory>
        <restdoc.directory>${project.build.directory}/restapi</restdoc.directory>
        <send.mail.disabled>true</send.mail.disabled>
        <atlassian.dev.mode>true</atlassian.dev.mode>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-jira-plugin</artifactId>
                <version>${amps.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <productVersion>${jira.version}</productVersion>
                    <productDataVersion>${jira.data.version}</productDataVersion>
                    <jvmArgs>-Xmx768m -XX:MaxPermSize=300m</jvmArgs>
                    <functionalTestPattern>it/**/*.java</functionalTestPattern>
                    <systemPropertyVariables>
                        <atlassian.mail.senddisabled>${send.mail.disabled}</atlassian.mail.senddisabled>
                        <atlassian.dev.mode>${atlassian.dev.mode}</atlassian.dev.mode>
                        <jira.websudo.is.disabled>true</jira.websudo.is.disabled>
                        <user.language>en</user.language>
                        <user.region>AU</user.region>
                        <user.timezone>Australia/Sydney</user.timezone>
                    </systemPropertyVariables>
                    <skipITs>${skipTests}</skipITs>
                    <pluginArtifacts>
                        <pluginArtifact>
                            <groupId>com.atlassian.jira</groupId>
                            <artifactId>jira-func-test-plugin</artifactId>
                            <version>${jira.functest.version}</version>
                        </pluginArtifact>
                        <pluginArtifact>
                            <groupId>com.atlassian.jira.tests</groupId>
                            <artifactId>jira-testkit-plugin</artifactId>
                            <version>${testkit.version}</version>
                        </pluginArtifact>
                    </pluginArtifacts>
                    <extractDependencies>false</extractDependencies>
                    <instructions>
                        <Include-Resource>
                            {maven-resources};
                            ${project.build.outputDirectory}/resourcedoc.xml;
                            ${xsl.directory}/application-grammars.xml;
                            ${xsl.directory}/application-doc.xml;
                        </Include-Resource>
                        <Import-Package>
                            javax.xml.bind*;version="2.1.0",
                            com.atlassian.jira.rest,
                            *
                        </Import-Package>
                        <Export-Package>
                            com.atlassian.jira.rest.api.*;version="${project.version}";-noimport:=true,
                            com.atlassian.jira.rest.v1.*;version="${project.version}";-noimport:=true,
                            com.atlassian.jira.rest.v2.*;version="${project.version}";-noimport:=true,
                        </Export-Package>
                        <DynamicImport-Package>org.springframework.*,org.aopalliance.*</DynamicImport-Package>
                    </instructions>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>com.atlassian.plugins.rest</groupId>
                        <artifactId>atlassian-rest-doclet</artifactId>
                        <version>${atlassian.rest.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.4.3</version>
                <executions>
                    <execution>
                        <id>copy-xsl-resources</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${xsl.directory}</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${basedir}/src/main/doc</directory>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>localtest.properties</include>
                </includes>

            </testResource>
            <testResource>
                <directory>src/test/xml</directory>
                <targetPath>xml</targetPath>
                <filtering>false</filtering>
                <includes>
                    <include>*.xml</include>
                </includes>
            </testResource>
        </testResources>
        <resources>
            <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>
    </build>

    <profiles>
        <profile>
            <id>ci-test</id>
            <properties>
                <send.mail.disabled>false</send.mail.disabled>
                <atlassian.dev.mode>false</atlassian.dev.mode>
            </properties>
        </profile>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.atlassian.maven.plugins</groupId>
                        <artifactId>maven-jira-plugin</artifactId>
                        <version>${amps.version}</version>
                        <extensions>true</extensions>
                        <executions>
                            <execution>
                                <id>integration-test</id>
                                <phase>none</phase>
                            </execution>
                        </executions>
                    </plugin>


                    <!--generating rest api docs-->
                    <plugin>
                        <artifactId>maven-resources-plugin</artifactId>
                        <version>2.4.3</version>
                        <executions>
                            <execution>
                                <id>copy-js-resources</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${restdoc.directory}</outputDirectory>
                                    <resources>
                                        <resource>
                                            <directory>src/main/js</directory>
                                            <filtering>true</filtering>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>1.7</version>
                        <executions>
                            <execution>
                                <id>schemaGen-plugin-description</id>
                                <phase>process-classes</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <tasks>
                                        <copy file="${project.build.outputDirectory}/resourcedoc.xml" tofile="${restdoc.directory}/resourcedoc.xml" />
                                    </tasks>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>com.sun.jersey.contribs</groupId>
                        <artifactId>maven-wadl-plugin</artifactId>
                        <version>1.8</version>
                        <executions>
                            <execution>
                                <id>generate</id>
                                <goals>
                                    <goal>generate</goal>
                                </goals>
                                <phase>prepare-package</phase>
                            </execution>
                        </executions>

                        <dependencies>
                            <dependency>
                                <groupId>org.slf4j</groupId>
                                <artifactId>slf4j-simple</artifactId>
                                <version>${slf4j.version}</version>
                            </dependency>
                            <dependency>
                                <groupId>com.atlassian.jira</groupId>
                                <artifactId>jira-api</artifactId>
                                <version>${jira.version}</version>
                            </dependency>
                        </dependencies>

                        <configuration>
                            <wadlFile>${restdoc.directory}/jira-rest-plugin.wadl</wadlFile>
                            <formatWadlFile>true</formatWadlFile>
                            <baseUri>http://example.com:8080/jira/rest/</baseUri>
                            <packagesResourceConfig>
                                <param>com.atlassian.jira.rest.auth</param>
                                <param>com.atlassian.jira.rest.v2</param>
                            </packagesResourceConfig>
                            <wadlGenerators>
                                <wadlGeneratorDescription>
                                    <className>com.sun.jersey.server.wadl.generators.WadlGeneratorApplicationDoc
                                    </className>
                                    <properties>
                                        <property>
                                            <name>applicationDocsFile</name>
                                            <value>${xsl.directory}/application-doc.xml</value>
                                        </property>
                                    </properties>
                                </wadlGeneratorDescription>
                                <wadlGeneratorDescription>
                                    <className>com.sun.jersey.server.wadl.generators.WadlGeneratorGrammarsSupport
                                    </className>
                                    <properties>
                                        <property>
                                            <name>grammarsFile</name>
                                            <value>${xsl.directory}/application-grammars.xml</value>
                                        </property>
                                    </properties>
                                </wadlGeneratorDescription>
                                <wadlGeneratorDescription>
                                    <className>
                                        com.atlassian.plugins.rest.doclet.generators.resourcedoc.AtlassianWadlGeneratorResourceDocSupport
                                    </className>
                                    <properties>
                                        <property>
                                            <name>resourceDocFile</name>
                                            <value>${restdoc.directory}/resourcedoc.xml</value>
                                        </property>
                                    </properties>
                                </wadlGeneratorDescription>
                            </wadlGenerators>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>xml-maven-plugin</artifactId>
                        <version>1.0</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>transform</goal>
                                </goals>
                                <phase>package</phase>
                            </execution>
                        </executions>
                        <configuration>
                            <transformationSets>
                                <transformationSet>
                                    <dir>${restdoc.directory}</dir>
                                    <includes>
                                        <include>jira-rest-plugin.wadl</include>
                                    </includes>

                                    <stylesheet>${xsl.directory}/wadl-documentation.xsl</stylesheet>
                                    <outputProperties>
                                        <outputProperty>
                                            <name>indent</name>
                                            <value>no</value>
                                        </outputProperty>
                                    </outputProperties>

                                    <outputDir>${restdoc.directory}</outputDir>
                                    <fileMappers>
                                        <fileMapper implementation="org.codehaus.plexus.components.io.filemappers.RegExpFileMapper">
                                            <pattern>jira-rest-plugin.wadl</pattern>
                                            <replacement>index.html</replacement>
                                        </fileMapper>
                                    </fileMappers>
                                </transformationSet>
                            </transformationSets>
                        </configuration>
                        <dependencies>
                            <dependency>
                                <groupId>net.sf.saxon</groupId>
                                <artifactId>saxon</artifactId>
                                <version>8.7</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>create-api-zip</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <descriptors>
                                        <descriptor>src/main/assembly/apidocs.xml</descriptor>
                                    </descriptors>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>hallelujahClient</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.atlassian.maven.plugins</groupId>
                        <artifactId>maven-jira-plugin</artifactId>
                        <configuration>
                            <enableFastdev>false</enableFastdev>
                            <systemPropertyVariables>
                                <atlassian.dev.mode>false</atlassian.dev.mode>
                                <jira.websudo.is.disabled>true</jira.websudo.is.disabled>
                                <atlassian.mail.senddisabled>false</atlassian.mail.senddisabled>
                            </systemPropertyVariables>
                            <products>
                                <product>
                                    <id>jira</id>
                                    <version>${jira.version}</version>
                                    <dataVersion>${jira.data.version}</dataVersion>
                                </product>
                            </products>
                            <testGroups>
                                <testGroup>
                                    <id>hallelujahClient</id>
                                    <includes>
                                        <include>**/RestHallelujahClient.java</include>
                                    </includes>
                                    <productIds>
                                        <productId>jira</productId>
                                    </productIds>
                                </testGroup>
                            </testGroups>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <includes />
                            <excludes>
                                <exclude>**/**</exclude>
                            </excludes>
                            <forkMode>once</forkMode>

                        </configuration>
                    </plugin>
                </plugins>
            </build>
            <properties>
                <testGroups>hallelujahClient</testGroups>
                <!--<skipTests>true</skipTests>-->
            </properties>
        </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>com.atlassian.jira.rest.hallelujah.RestHallelujahServer</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>
                <atlassian.test.run.only.quarantined>false</atlassian.test.run.only.quarantined>
                <atlassian.test.suite.excludes />
                <atlassian.test.suite.includes />
                <atlassian.test.suite.package>com.atlassian.jira.rest</atlassian.test.suite.package>
                <atlassian.test.target.dir>${project.build.directory}</atlassian.test.target.dir>
                <jira.functest.single.testclass />
                <jira.hallelujah.queueId />
            </properties>
        </profile>

    </profiles>

    <dependencies>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>embedded-crowd-api</artifactId>
            <version>2.7.0-m10</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>embedded-crowd-core</artifactId>
            <version>2.7.0-m10</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <scope>provided</scope>
            <version>3.1</version>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-rest-api</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-common</artifactId>
            <scope>provided</scope>
        </dependency>
        <!-- HACK: this shoud 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>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <!-- for some obscure reason it needs to be a module dep and not just a dep of the antrun plugin (ask Min'an) -->
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-doclet</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>jsr311-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <scope>provided</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>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.6</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.core</groupId>
            <artifactId>atlassian-core</artifactId>
            <version>4.6.2</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.classloader</groupId>
            <artifactId>atlassian-classloader</artifactId>
            <version>1.0</version>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-client</artifactId>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-server</artifactId>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-json</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.buildeng.hallelujah</groupId>
            <artifactId>client</artifactId>
            <version>${hallelujah.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.sun.grizzly</groupId>
                    <artifactId>grizzly-servlet-webserver</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jersey</groupId>
                    <artifactId>jersey-grizzly</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jersey.jersey-test-framework</groupId>
                    <artifactId>jersey-test-framework-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jersey.jersey-test-framework</groupId>
                    <artifactId>jersey-test-framework-grizzly</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jersey.contribs</groupId>
                    <artifactId>jersey-atom-abdera</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jersey.contribs</groupId>
                    <artifactId>jersey-multipart</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jersey.contribs</groupId>
                    <artifactId>jersey-guice</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jersey.contribs</groupId>
                    <artifactId>jersey-spring</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jersey</groupId>
                    <artifactId>jersey-atom</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jersey</groupId>
                    <artifactId>jersey-fastinfoset</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>
</project>
