<?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>

  <parent>
    <groupId>com.atlassian.bamboo</groupId>
    <artifactId>atlassian-bamboo-plugins2-parent</artifactId>
    <version>6.3.0</version>
  </parent>

  <groupId>com.atlassian.bamboo.plugins</groupId>
  <artifactId>atlassian-bamboo-plugin-web-resources</artifactId>
  <packaging>atlassian-plugin</packaging>

  <name>Atlassian Bamboo Web Resources Plugin</name>
  <description>Atlassian Bamboo Web Resources Plugin</description>

  <properties>
    <!-- to simplify referencing in other plugins -->
    <atlassian.plugin.key>bamboo.web.resources.common</atlassian.plugin.key>
  </properties>

  <dependencies>
    <dependency>
      <groupId>com.atlassian.bamboo</groupId>
      <artifactId>atlassian-bamboo-core</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.atlassian.json</groupId>
      <artifactId>atlassian-json-api</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.atlassian.plugin</groupId>
      <artifactId>atlassian-spring-scanner-annotation</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.atlassian.plugins</groupId>
      <artifactId>atlassian-plugins-webresource</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.atlassian.sal</groupId>
      <artifactId>sal-api</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.codehaus.jackson</groupId>
      <artifactId>jackson-mapper-asl</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-all</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>com.atlassian.maven.plugins</groupId>
        <artifactId>maven-bamboo-plugin</artifactId>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
            <Spring-Context>*</Spring-Context>
            <Export-Package>
            </Export-Package>
            <Import-Package>
              *
            </Import-Package>
          </instructions>
          <compressResources>false</compressResources>
          <systemPropertyVariables>
            <!--
              Having JavaScript transpilation enabled requires changing plugin resources directory.
              It has to point to the transpiled resources.
              See https://extranet.atlassian.com/display/BAMBOO/Bamboo+Frontend+-+ES6+-+How+to+set+up
            -->
            <plugin.resource.directories>${project.build.directory}/classes</plugin.resource.directories>
          </systemPropertyVariables>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.atlassian.plugin</groupId>
        <artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
      </plugin>

      <!-- Generate front-end resources -->
      <plugin>
        <groupId>com.github.eirslett</groupId>
        <artifactId>frontend-maven-plugin</artifactId>
        <configuration>
          <environmentVariables>
            <plugin_path>${project.basedir}</plugin_path>
          </environmentVariables>
        </configuration>
        <executions>
          <execution>
            <id>generate-resources</id>
            <goals>
              <goal>npm</goal>
            </goals>
            <configuration>
              <arguments>run maven-build-plugin</arguments>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>

    <!-- workaround for missing feature in AMPS-4.1 -->
    <testResources>
      <testResource>
        <directory>src/test/resources</directory>
        <filtering>true</filtering>
        <includes>
          <include>atlassian-plugin.xml</include>
        </includes>
      </testResource>
      <testResource>
        <directory>src/test/resources</directory>
        <filtering>false</filtering>
        <excludes>
          <exclude>atlassian-plugin.xml</exclude>
        </excludes>
      </testResource>
    </testResources>

  </build>

</project>
