<?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">
    <parent>
        <artifactId>servicedesk-approvals-parent</artifactId>
        <groupId>com.atlassian.servicedesk</groupId>
        <version>3.1.0-OD-05-001-D20151113T073049</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>

    <artifactId>servicedesk-approvals-plugin</artifactId>

    <name>Service Desk Approvals Plugin</name>
    <description>Approvals plugin for Service Desk</description>
    <packaging>atlassian-plugin</packaging>

    <dependencies>

        <!-- SD -->
        <dependency>
            <groupId>com.atlassian.servicedesk</groupId>
            <artifactId>jira-servicedesk-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.servicedesk</groupId>
            <artifactId>jira-servicedesk-internal-api</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- JIRA -->
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Atlassian Pocketknife -->
        <dependency>
            <groupId>com.atlassian.pocketknife</groupId>
            <artifactId>atlassian-pocketknife-core</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.pocketknife</groupId>
            <artifactId>pocketknife-features-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Atlassian Spring Scanner-->
        <dependency>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-annotation</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-runtime</artifactId>
        </dependency>

        <!-- Spring dependencies -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>org.springframework.context</artifactId>
            <scope>provided</scope>
        </dependency>

        <!--Unit Test-->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <resources>
            <!--
                We use gulp (via the mvn exec plugin) transform and copy frontend resources to the frontend-resources
                directory. So we need to let maven know where to find them so they still get bundled in the jar.
            -->
            <resource>
                <directory>target/frontend-resources</directory>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <excludes>
                    <!--
                        These frontend resources are copied across to target/frontend-resources
                        See: gulpfile.babel.js
                    -->
                    <exclude>**/*.js</exclude>
                    <exclude>**/*.less</exclude>
                    <exclude>**/*.css</exclude>
                    <exclude>**/*.soy</exclude>
                </excludes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <!-- tell maven to replace ${var} variables with their build time values -->
                <filtering>true</filtering>
            </resource>
        </resources>

        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>process-frontend-resources</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <workingDirectory>../</workingDirectory>
                            <executable>node_modules/gulp/bin/gulp.js</executable>
                            <arguments>
                                <argument>generate-approvals-resources</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>com.atlassian.plugin</groupId>
                <artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
                <version>${atlassian.spring.scanner.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>atlassian-spring-scanner</goal>
                        </goals>
                        <phase>process-classes</phase>
                    </execution>
                </executions>
                <configuration>
                    <!--
                    These dependencies of SD will be scanned for @Components etc..
                    and hence can be considered part of our code base as well as code
                    in plugin/src/main (which is implicitly scanned).
                    -->
                    <scannedDependencies></scannedDependencies>
                    <!-- Turn this on to true to show the inner workings of the build time scanner -->
                    <verbose>false</verbose>
                </configuration>
            </plugin>

            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-jira-plugin</artifactId>
                <version>${amps.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <productVersion>${jira.version.parent}</productVersion>
                    <productDataVersion>${jira.version.parent}</productDataVersion>
                    <closureJsCompiler>true</closureJsCompiler>
                    <enableFastdev>false</enableFastdev>
                    <enableDevToolbox>false</enableDevToolbox>
                    <systemPropertyVariables>
                        <plugin.resource.directories>${basedir}/target/frontend-resources</plugin.resource.directories>
                    </systemPropertyVariables>
                    <instructions>
                        <Atlassian-Plugin-Key>com.atlassian.servicedesk.approvals-plugin</Atlassian-Plugin-Key>
                        <Bundle-SymbolicName>com.atlassian.servicedesk.approvals-plugin</Bundle-SymbolicName>
                        <Spring-Context>*</Spring-Context>
                        <Private-Package></Private-Package>
                        <Export-Package>
                            com.atlassian.servicedesk.plugins.approvals.internal.obr.install
                        </Export-Package>
                        <Import-Package>
                            !org.springframework.osgi.service.exporter.support,
                            !org.springframework.osgi.service.importer.support,
                            <!-- BND cannot find this runtime dependency of the Atlassian plugin system -->
                            <!-- if you declare a com.atlassian.plugin.osgi.external.SingleModuleDescriptorFactory, in your code at runtime the actual -->
                            <!-- package that will be called is com.atlassian.plugin.osgi.bridge.external.SingleModuleDescriptorFactory -->
                            <!-- JIRA 7 and platform 4 use Gemini while the old uses SpringDM -->

                            <!-- At build time the BND plugin will expand this * into the actual packages your code needs access to by analyzing -->
                            <!-- all of your code and it's dependencies through byte code scanning -->
                            *
                        </Import-Package>
                        <Atlassian-Scan-Folders>servicedesk</Atlassian-Scan-Folders>
                    </instructions>
                    <extractDependencies>false</extractDependencies>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>