<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.atlassian.plugins</groupId>
        <artifactId>atlassian-plugins-webresource-parent</artifactId>
        <version>4.4.2</version>
    </parent>

    <artifactId>atlassian-plugins-webresource-rest</artifactId>
    <packaging>atlassian-plugin</packaging>

    <name>Atlassian Plugins - Web Resources REST</name>

    <properties>
        <atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
        <node.path>${project.parent.build.directory}</node.path>
        <sonar.coverage.jacoco.xmlReportPaths>${project.parent.basedir}${jacoco.report.file}</sonar.coverage.jacoco.xmlReportPaths>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.json</groupId>
            <artifactId>atlassian-json-api</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-webresource</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-webresource-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-common</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>javax.ws.rs-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <scope>provided</scope>
        </dependency>
        <!-- Test dependencies -->
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-webresource</artifactId>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-webresource-common</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.atlassian.fugue</groupId>
            <artifactId>fugue</artifactId>
            <scope>test</scope>
        </dependency>
        <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.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>amps-maven-plugin</artifactId>
                <version>${amps.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <jvmArgs>${jacoco.it.argLine}</jvmArgs>
                    <products>
                        <product>
                            <id>jira</id>
                            <version>${jira.version}</version>
                        </product>
                    </products>
                    <instructions>
                        <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
                        <Private-Package>com.atlassian.webresource.plugin</Private-Package>
                        <Import-Package>org.springframework.osgi.*;resolution:="optional",
                            org.eclipse.gemini.blueprint.*;resolution:="optional",
                            com.atlassian.html.encode*,
                            com.atlassian.json.marshal.*,
                            com.atlassian.plugin.*,
                            com.atlassian.plugin.servlet*,
                            com.atlassian.plugin.webresource*;version="${wrm.api.compat.version}",
                            com.atlassian.plugins.rest.common.security,
                            com.atlassian.webresource.api*;version="${wrm.api.compat.version}",
                            com.google.common.*,
                            io.atlassian.util.concurrent,
                            javax.naming.*,
                            javax.net.*,
                            javax.net.ssl.*,
                            javax.security.auth.*,
                            javax.ws.rs.*,
                            javax.xml.bind.annotation,
                            org.apache.commons.collections,
                            org.apache.commons.io,
                            org.apache.commons.lang3,
                            org.apache.commons.lang3.exception,
                            org.apache.http.*,
                            org.codehaus.jackson*,
                            org.slf4j</Import-Package>
                        <Spring-Context>*</Spring-Context>
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>${jdkLevel}</source>
                    <target>${jdkLevel}</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <!-- Compiling AMD modules. -->
        <profile>
            <id>build-atlassian-modules</id>
            <activation>
                <property>
                    <name>!skipAtlassianModulesBuild</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.github.eirslett</groupId>
                        <artifactId>frontend-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>03-run-atlassian-modules-builder</id>
                                <goals>
                                    <goal>yarn</goal>
                                </goals>
                                <phase>compile</phase>
                                <configuration>
                                    <arguments>wrm-compile</arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>npm-tests</id>
            <activation>
                <property>
                    <name>!skipTests</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.github.eirslett</groupId>
                        <artifactId>frontend-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>test-frontend</id>
                                <goals>
                                    <goal>yarn</goal>
                                </goals>
                                <phase>test</phase>
                                <configuration>
                                    <arguments>test</arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
