<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.applinks</groupId>
        <artifactId>applinks-parent</artifactId>
        <version>5.4.5</version>
    </parent>

    <artifactId>applinks-plugin</artifactId>
    <name>Applinks - Plugin - Core</name>
    <description>
        [PUBLIC] Atlassian Application Links core plugin. Application Links facilitates discovery, connections and
        authentication of Atlassian products with remote applications.
    </description>
    <packaging>atlassian-plugin</packaging>

    <properties>
        <!-- override these to support multiple instances without clashing -->
        <applinks.build.directory>${basedir}/target</applinks.build.directory>
        <jvm.debug.port>5001</jvm.debug.port>
        <!-- for amps:cli -->
        <http.port>5990</http.port>
        <context.path>/refapp1</context.path>
    </properties>

    <profiles>
        <!-- The profiles below can be used for running mvn amps:cli against any instance started from AMPS with
            default config, e.g. mvn amps:cli -Pjira -->
        <profile>
            <id>refapp2</id>
            <properties>
                <applinks.build.directory>${basedir}/target_refapp2</applinks.build.directory>
                <http.port>5992</http.port>
                <context.path>/refapp2</context.path>
                <jvm.debug.port>5002</jvm.debug.port>
            </properties>
        </profile>
        <profile>
            <id>refapp3</id>
            <properties>
                <applinks.build.directory>${basedir}/target_refapp3</applinks.build.directory>
                <http.port>5993</http.port>
                <context.path>/refapp2</context.path>
                <jvm.debug.port>5003</jvm.debug.port>
            </properties>
        </profile>
        <profile>
            <id>jira</id>
            <properties>
                <context.path>/jira</context.path>
                <http.port>2990</http.port>
            </properties>
        </profile>
        <profile>
            <id>confluence</id>
            <properties>
                <context.path>/confluence</context.path>
                <http.port>1990</http.port>
            </properties>
        </profile>
        <profile>
            <id>stash</id>
            <properties>
                <context.path>/stash</context.path>
                <http.port>7990</http.port>
            </properties>
        </profile>
        <profile>
            <id>bitbucket</id>
            <properties>
                <context.path>/bitbucket</context.path>
                <http.port>7990</http.port>
            </properties>
        </profile>
        <profile>
            <id>bamboo</id>
            <properties>
                <context.path>/bamboo</context.path>
                <http.port>6990</http.port>
            </properties>
        </profile>
        <profile>
            <id>fecru</id>
            <properties>
                <context.path>/fecru</context.path>
                <http.port>3990</http.port>
            </properties>
        </profile>

        <profile>
            <id>api-compat</id>
            <activation>
                <property>
                    <name>api-compat</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.atlassian.maven.plugins</groupId>
                        <artifactId>api-compat-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>

    </profiles>

    <build>
        <directory>${applinks.build.directory}</directory>
        <plugins>
            <!-- Runner plugins need to be explicitly defined here to pick up the parent configuration, because AMPS -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
            </plugin>
            <!-- Run Karma tests -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.1.1</version>
                <executions>
                    <execution>
                        <id>run-npm-install</id>
                        <phase>generate-test-resources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <workingDirectory>etc/karma-runner</workingDirectory>
                            <executable>npm</executable>
                            <arguments>
                                <argument>install</argument>
                            </arguments>
                            <skip>${skip.unit.tests}</skip>
                        </configuration>
                    </execution>
                    <execution>
                        <id>run-javascript-unit-tests</id>
                        <phase>test</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <workingDirectory>etc/karma-runner</workingDirectory>
                            <executable>npm</executable>
                            <arguments>
                                <argument>test</argument>
                            </arguments>
                            <skip>${skip.unit.tests}</skip>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-amps-plugin</artifactId>
                <version>${amps.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <log4jProperties>src/test/resources/log4j.properties</log4jProperties>
                    <instructions>
                        <!-- Ensure plugin is spring powered - see https://extranet.atlassian.com/x/xBS9hQ -->
                        <Spring-Context>*</Spring-Context>
                        <Import-Package>
                            javax.xml.bind*;version="2.1.0",
                            com.atlassian.jira.project;resolution:=optional,
                            com.cenqua.fisheye;resolution:=optional,
                            com.atlassian.confluence.spaces;resolution:=optional,
                            com.atlassian.bamboo.build;resolution:=optional,
                            net.oauth.*;version=20090617;resolution:=required,
                            org.json;resolution:=required,
                            com.atlassian.plugins.rest.common*;version=0.0.0,
                            com.atlassian.plugin.webresource*;version=0.0.0,
                            com.atlassian.sal.api*;version="2.10",
                            com.atlassian.velocity.htmlsafe;version="${htmlsafe.osgi.import.version}",
                            com.atlassian.templaterenderer*;version=!,
                            org.springframework.beans.factory;version="2.5",
                            org.springframework.beans.factory.annotation;version="2.5",
                            *;resolution:=optional,
                        </Import-Package>
                        <!-- NOTE: those is all _internal_ packages from applinks-common, exported to share with other
                             applinks plugins. The actual Applinks APIs/SPIs are exported by the host product. -->
                        <!-- Over time all the packages below should be collapsed into
                             com.atlassian.applinks.internal.common -->
                        <Export-Package>
                            com.atlassian.applinks.internal.status*,
                            com.atlassian.applinks.internal.common*,
                            com.atlassian.applinks.internal.rest*,
                            com.atlassian.applinks.internal.application.*,
                            com.atlassian.applinks.application.*,
                            com.atlassian.applinks.core.*,
                            com.atlassian.applinks.core.rest.context.*,
                            com.atlassian.applinks.ui*,
                            com.atlassian.applinks.ui.validators.*,
                        </Export-Package>
                    </instructions>
                    <products>
                        <product>
                            <id>refapp</id>
                            <version>${refapp.version}</version>
                            <!-- remove once AMPSDEV-120 or a better solution is implemented -->
                            <containerId>tomcat8x</containerId>
                        </product>
                    </products>
                    <libArtifacts>
                        <libArtifact>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>applinks-api</artifactId>
                        </libArtifact>
                        <libArtifact>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>applinks-host</artifactId>
                        </libArtifact>
                        <libArtifact>
                            <groupId>com.atlassian.applinks</groupId>
                            <artifactId>applinks-spi</artifactId>
                        </libArtifact>
                    </libArtifacts>
                    <pluginArtifacts>
                        <pluginArtifact>
                            <groupId>com.atlassian.oauth</groupId>
                            <artifactId>atlassian-oauth-api</artifactId>
                        </pluginArtifact>
                        <pluginArtifact>
                            <groupId>com.atlassian.oauth</groupId>
                            <artifactId>atlassian-oauth-consumer-spi</artifactId>
                        </pluginArtifact>
                        <pluginArtifact>
                            <groupId>com.atlassian.oauth</groupId>
                            <artifactId>atlassian-oauth-service-provider-spi</artifactId>
                        </pluginArtifact>
                        <pluginArtifact>
                            <groupId>com.atlassian.oauth</groupId>
                            <artifactId>atlassian-oauth-consumer-sal-plugin</artifactId>
                        </pluginArtifact>
                        <pluginArtifact>
                            <groupId>com.atlassian.oauth</groupId>
                            <artifactId>atlassian-oauth-consumer-plugin</artifactId>
                        </pluginArtifact>
                        <pluginArtifact>
                            <groupId>com.atlassian.oauth</groupId>
                            <artifactId>atlassian-oauth-service-provider-plugin</artifactId>
                        </pluginArtifact>
                        <pluginArtifact>
                            <groupId>com.atlassian.oauth</groupId>
                            <artifactId>atlassian-oauth-service-provider-sal-plugin</artifactId>
                        </pluginArtifact>
                        <pluginArtifact>
                            <groupId>com.atlassian.oauth</groupId>
                            <artifactId>atlassian-oauth-admin-plugin</artifactId>
                        </pluginArtifact>
                    </pluginArtifacts>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.github.kongchen</groupId>
                <artifactId>swagger-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <dependencies>

        <!-- Applinks dependencies -->
        <dependency>
            <groupId>com.atlassian.applinks</groupId>
            <artifactId>applinks-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.applinks</groupId>
            <artifactId>applinks-host</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.applinks</groupId>
            <artifactId>applinks-spi</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.applinks</groupId>
            <artifactId>applinks-common</artifactId>
        </dependency>

        <!-- Atlassian dependencies -->
        <dependency>
            <groupId>com.atlassian.sal</groupId>
            <artifactId>sal-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <!-- The status API requires dependency on OAuth -->
        <dependency>
            <groupId>com.atlassian.oauth</groupId>
            <artifactId>atlassian-oauth-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.oauth</groupId>
            <artifactId>atlassian-oauth-consumer-spi</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.event</groupId>
            <artifactId>atlassian-event</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-module</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.util.concurrent</groupId>
            <artifactId>atlassian-util-concurrent</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.templaterenderer</groupId>
            <artifactId>atlassian-template-renderer-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.soy</groupId>
            <artifactId>soy-template-renderer-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.velocity.htmlsafe</groupId>
            <artifactId>velocity-htmlsafe</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-webresource</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-webfragment</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-spring</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.cache</groupId>
            <artifactId>atlassian-cache-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian</groupId>
            <artifactId>atlassian-localhost</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.http</groupId>
            <artifactId>atlassian-http</artifactId>
            <scope>compile</scope>
        </dependency>
        <!-- To support legacy Confluence action for managing space links -->
        <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>confluence</artifactId>
            <scope>provided</scope>
            <exclusions>
                <!-- In order to be able to use slf4j-nop for tests, this must be excluded -->
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.octo.captcha</groupId>
                    <artifactId>jcaptcha-all</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.atlassian.sal</groupId>
                    <artifactId>sal-spi</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.atlassian.security.auth.trustedapps</groupId>
                    <artifactId>atlassian-trusted-apps-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.servlet</groupId>
                    <artifactId>servlet-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.atlassian.refapp</groupId>
            <artifactId>atlassian-refapp-sal-plugin</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.atlassian.security.auth.trustedapps</groupId>
                    <artifactId>atlassian-trusted-apps-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.atlassian.sal</groupId>
                    <artifactId>sal-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.atlassian.sal</groupId>
                    <artifactId>sal-spi</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.atlassian.sal</groupId>
                    <artifactId>sal-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>


        <!-- 3rd party dependencies -->
        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>jsr250-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.analytics</groupId>
            <artifactId>analytics-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-nop</artifactId>
            <scope>test</scope>
        </dependency>


        <!-- Test dependencies - Applinks -->
        <dependency>
            <groupId>com.atlassian.applinks</groupId>
            <artifactId>applinks-test-common</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.applinks</groupId>
            <artifactId>applinks-common</artifactId>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>

        <!-- Test dependencies - 3rd party -->
        <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>
        <dependency>
            <groupId>org.reflections</groupId>
            <artifactId>reflections</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.cache</groupId>
            <artifactId>atlassian-cache-memory</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jettison</groupId>
            <artifactId>jettison</artifactId>
            <version>1.3.5</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.github.stefanbirkner</groupId>
            <artifactId>system-rules</artifactId>
            <version>1.5.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.module</groupId>
            <artifactId>jackson-module-jaxb-annotations</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>
