<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">
  <parent>
    <groupId>com.atlassian.bamboo</groupId>
    <artifactId>atlassian-bamboo-components</artifactId>
    <version>9.3.0-m012</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <artifactId>atlassian-bamboo-agent-elastic-s3-bucket</artifactId>
  <name>Atlassian Bamboo Elastic Agent Assembly</name>
  <packaging>aws</packaging>

  <dependencies>

    <dependency>
      <groupId>com.atlassian.bamboo</groupId>
      <artifactId>atlassian-bamboo-api</artifactId>
    </dependency>

    <dependency>
      <groupId>com.atlassian.bamboo</groupId>
      <artifactId>atlassian-bamboo-core</artifactId>
    </dependency>

    <dependency>
      <groupId>com.atlassian.bamboo</groupId>
      <artifactId>atlassian-bamboo-agent-remote</artifactId>
    </dependency>

    <dependency>
      <groupId>com.atlassian.bamboo</groupId>
      <artifactId>atlassian-bamboo-elastic-image</artifactId>
      <type>ami</type>
    </dependency>

    <dependency>
      <groupId>com.atlassian.bamboo</groupId>
      <artifactId>atlassian-bamboo-plugins1-plugins</artifactId>
      <type>pom</type>
      <exclusions>
        <exclusion>
          <groupId>com.atlassian.bamboo</groupId>
          <artifactId>atlassian-bamboo-upgrade</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>com.atlassian.bamboo</groupId>
      <artifactId>atlassian-bamboo-bundled-plugins</artifactId>
      <type>txt</type>
    </dependency>

    <dependency>
      <groupId>com.atlassian.bamboo</groupId>
      <artifactId>atlassian-bamboo-agent-elastic-s3-bucket-boot</artifactId>
      <version>${project.version}</version>
      <type>list</type>
    </dependency>

    <dependency>
      <groupId>com.atlassian.aws</groupId>
      <artifactId>atlassian-aws</artifactId>
    </dependency>

    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
    </dependency>

    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
    </dependency>

    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <scope>runtime</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>get-amis</id>
            <goals>
              <goal>copy</goal>
            </goals>
            <phase>compile</phase>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>com.atlassian.bamboo</groupId>
                  <artifactId>atlassian-bamboo-elastic-image</artifactId>
                  <type>ami</type>
                  <overWrite>true</overWrite>
                  <outputDirectory>${project.build.directory}</outputDirectory>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>

          <execution>
            <id>extract-framework-bundles</id>
            <phase>process-resources</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>com.atlassian.plugins</groupId>
                  <artifactId>atlassian-plugins-framework-bundles</artifactId>
                  <version>${plug.version}</version>
                  <type>zip</type>
                  <classifier>${plug.classifier.override}</classifier>
                  <outputDirectory>${project.build.directory}/framework-bundles</outputDirectory>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
          <execution>
            <id>copy-framework-bundles-dependencies</id>
            <phase>process-resources</phase>
            <goals>
              <goal>copy</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <!-- exports org.apache.commons.logging -->
                  <groupId>org.slf4j</groupId>
                  <artifactId>jcl-over-slf4j</artifactId>
                  <outputDirectory>${project.build.directory}/framework-bundles</outputDirectory>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.atlassian.maven.plugins</groupId>
        <artifactId>aws-maven-plugin</artifactId>
        <extensions>true</extensions>
        <configuration>
          <imageListFile>${project.build.directory}/atlassian-bamboo-elastic-image-${elastic-image.version}.ami</imageListFile>
          <awsDataFile>${project.build.directory}/atlassian-bamboo-elastic-image-${elastic-image.version}.ami</awsDataFile>
          <awsSecretAccessKey>${aws.secretAccessKey}</awsSecretAccessKey>
          <awsAccessKeyID>${aws.accessKeyID}</awsAccessKeyID>
          <regionalisedBuckets>
            <regionalisedBucket>${s3.imageBucketStem}</regionalisedBucket>
            <regionalisedBucket>${s3.agentAssemblyBucketStem}</regionalisedBucket>
          </regionalisedBuckets>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <!-- override top level POM rule -->
          <execution>
            <id>enforce_spring_scanner_scope</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <phase>validate</phase>
            <configuration>
              <rules>
                <bannedDependencies>
                  <searchTransitive>false</searchTransitive>
                  <message>spring-scanner 1.x must NOT be pulled</message>
                  <excludes>
                    <exclude>com.atlassian.plugin:atlassian-spring-scanner-annotation:(,2):*:*</exclude>
                    <exclude>com.atlassian.plugin:atlassian-spring-scanner-runtime:(,2):*:*</exclude>
                  </excludes>
                </bannedDependencies>
              </rules>
              <fail>true</fail>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
