<?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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <artifactId>confluence-roadmap-plugin</artifactId>

    <organization>
        <name>Atlassian</name>
        <url>http://www.atlassian.com/</url>
    </organization>

    <name>Confluence Roadmap Planner</name>
    <description>Create a simple, visual roadmap for planning projects, software releases and more.</description>

    <packaging>atlassian-plugin</packaging>

    <parent>
        <groupId>com.atlassian.confluence.plugins</groupId>
        <artifactId>confluence-roadmap-plugin-parent</artifactId>
        <version>14.2.0</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>confluence</artifactId>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>commons-lang</groupId>
                    <artifactId>commons-lang</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.sal</groupId>
            <artifactId>sal-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.xmlgraphics</groupId>
            <artifactId>batik-css</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.xmlgraphics</groupId>
            <artifactId>batik-ext</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.xmlgraphics</groupId>
            <artifactId>batik-svggen</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.xmlgraphics</groupId>
            <artifactId>batik-dom</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.xmlgraphics</groupId>
            <artifactId>batik-transcoder</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.xmlgraphics</groupId>
            <artifactId>batik-util</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>xalan</groupId>
            <artifactId>xalan</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>xml-apis</groupId>
            <artifactId>xml-apis-ext</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence.plugins</groupId>
            <artifactId>confluence-create-content-plugin</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Test Dependencies -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-library</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <!-- Profile for Karma unit testing. Skips all other tests -->
            <id>karma</id>
            <dependencies>
                <!-- Only exists for qunit -->
                <dependency>
                    <groupId>com.atlassian.soy</groupId>
                    <artifactId>soy-template-plugin</artifactId>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>com.atlassian.plugins</groupId>
                    <artifactId>jquery</artifactId>
                    <version>${jquery.version}</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>com.atlassian.aui</groupId>
                    <artifactId>auiplugin</artifactId>
                    <version>${aui.version}</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>com.atlassian.aui</groupId>
                    <artifactId>aui-soy</artifactId>
                    <version>${aui.version}</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <!-- Install npm modules first -->
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>1.2.1</version>
                        <executions>
                            <execution>
                                <id>install-npm-modules</id>
                                <phase>generate-test-sources</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <executable>npm</executable>
                            <arguments>
                                <argument>install</argument>
                            </arguments>
                        </configuration>
                    </plugin>

                    <plugin>
                        <!-- Extract AUI for use in tests -->
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>extract-qunit-dependencies</id>
                                <phase>generate-test-resources</phase>
                                <goals>
                                    <goal>unpack-dependencies</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${project.build.directory}/qunit/dependencies</outputDirectory>
                                    <includeGroupIds>com.atlassian.aui,com.atlassian.soy,com.atlassian.plugins</includeGroupIds>
                                    <includeArtifactIds>auiplugin,soy-template-plugin,jquery</includeArtifactIds>
                                    <includes>i18n/aui.properties</includes>
                                    <includes>**/*-min.js,**/*.soy,**/*.properties,**/inline-dialog2.js</includes>
                                </configuration>
                            </execution>
                        </executions>
                        <configuration>
                            <useJvmChmod>true</useJvmChmod>
                        </configuration>
                    </plugin>

                    <plugin>
                        <!-- Run the karma tests during test phase -->
                        <groupId>com.kelveden</groupId>
                        <artifactId>maven-karma-plugin</artifactId>
                        <version>1.8</version>
                        <executions>
                            <execution>
                                <id>run-karma-tests</id>
                                <goals>
                                    <goal>start</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <!-- Use Phantom for the automated build because I couldn't get Chrome to work on a Bamboo agent -->
                            <browsers>PhantomJS</browsers>
                            <karmaExecutable>node_modules/karma/bin/karma</karmaExecutable>
                        </configuration>
                    </plugin>

                    <plugin>
                        <groupId>com.atlassian.maven.plugins</groupId>
                        <artifactId>soy-to-js-maven-plugin</artifactId>
                        <version>1.8</version>
                        <dependencies>
                            <dependency>
                                <groupId>com.atlassian.confluence</groupId>
                                <artifactId>confluence-karma-testrunner-support</artifactId>
                                <version>0.0.9</version>
                            </dependency>
                        </dependencies>
                        <executions>
                            <execution>
                                <id>generate-aui-js-from-soy</id>
                                <phase>generate-test-resources</phase>
                                <goals>
                                    <goal>compile</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${project.build.directory}/qunit/soy</outputDirectory>
                                    <resources>
                                        <directory>${project.build.directory}/qunit/dependencies/soy/</directory>
                                        <includes>
                                            <include>**/*.soy</include>
                                        </includes>
                                    </resources>
                                    <propertiesFile>${project.build.directory}/qunit/dependencies/i18n/aui.properties</propertiesFile>
                                </configuration>
                            </execution>
                            <execution>
                                <id>generate-js-from-soy</id>
                                <phase>generate-test-resources</phase>
                                <goals>
                                    <goal>compile</goal>
                                </goals>
                                <configuration>
                                    <module>com.atlassian.confluence.test.support.karma.CustomFunctionTransformModule</module>
                                    <outputDirectory>${project.build.directory}/qunit/soy</outputDirectory>
                                    <resources>
                                        <directory>${project.basedir}/src/main/resources/</directory>
                                        <includes>
                                            <include>**/*.soy</include>
                                        </includes>
                                        <excludes>
                                            <exclude>notifications/*.soy</exclude>
                                        </excludes>
                                    </resources>
                                    <propertiesFile>${project.basedir}/src/main/resources/confluence-roadmap-plugin.properties</propertiesFile>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- skip ITs -->
                    <plugin>
                        <groupId>com.atlassian.maven.plugins</groupId>
                        <artifactId>maven-confluence-plugin</artifactId>
                        <version>${amps.version}</version>
                        <configuration>
                            <skipITs>true</skipITs>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
            <properties>
                <!-- Skips unit tests -->
                <maven.test.unit.skip>true</maven.test.unit.skip>
            </properties>
        </profile>
    </profiles>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5</version>
                <configuration>
                    <arguments>-Prelease -DskipTests</arguments>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.17</version>
                <configuration>
                    <!-- Ignoring integration tests on test phase so they just run in integration-test phase.-->
                    <!-- This configuration is necessary when using AMPS together with a parent POM.-->
                    <excludes>
                        <exclude>it/**</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-confluence-plugin</artifactId>
                <version>${amps.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <productVersion>${confluence.version}</productVersion>
                    <productDataVersion>${confluence.data.version}</productDataVersion>

                    <instructions>
                        <Atlassian-Plugin-Key>${project.groupId}.${project.artifactId}</Atlassian-Plugin-Key>
                        <Spring-Context>*</Spring-Context>
                        <Export-Package>
                            com.atlassian.plugins.roadmap.upgradetask.*,
                        </Export-Package>
                        <Import-Package>
                            com.atlassian.confluence.plugins.createcontent.api.*,
                            com.atlassian.event.api.*,
                            com.atlassian.sal.api.upgrade.*,
                            com.atlassian.sal.api.message.*,
                            org.springframework.transaction;version="[0.0.0,0.0.0]",
                            *;resolution:=optional
                        </Import-Package>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
