<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>9.2.4</version>
  </parent>

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

  <name>Atlassian Bamboo REST plugin</name>
  <description>REST API for Bamboo</description>

  <properties>
    <atlassian.plugin.key>com.atlassian.bamboo.plugins.rest</atlassian.plugin.key>
    <jersey.release.version>1.19.4</jersey.release.version>
    <!-- a version of maven-wadl-plugin patched to fix https://java.net/jira/browse/JERSEY-2709 -->
    <jersey.wadl.plugin.version>1.19-atlassian-7</jersey.wadl.plugin.version>
  </properties>

  <dependencies>

    <dependency>
      <groupId>com.atlassian.bamboo</groupId>
      <artifactId>atlassian-bamboo-web</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.atlassian.bamboo</groupId>
      <artifactId>atlassian-bamboo-rest-model</artifactId>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.atlassian.bamboo</groupId>
      <artifactId>atlassian-bamboo-rest-common</artifactId>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.atlassian.bamboo</groupId>
      <artifactId>atlassian-bamboo-charts</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.atlassian.bamboo</groupId>
      <artifactId>atlassian-bamboo-deployments-api</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.atlassian.bamboo</groupId>
      <artifactId>atlassian-bamboo-deployments</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.atlassian.bamboo</groupId>
      <artifactId>atlassian-bamboo-import-export</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.atlassian.bamboo</groupId>
      <artifactId>atlassian-bamboo-utils</artifactId>
      <scope>provided</scope>
    </dependency>

    <!-- other Atlassian dependencies -->
    <dependency>
      <groupId>com.atlassian.annotations</groupId>
      <artifactId>atlassian-annotations</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.atlassian.plugins</groupId>
      <artifactId>atlassian-plugins-core</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.rest</groupId>
      <artifactId>atlassian-rest-common</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.atlassian.sal</groupId>
      <artifactId>sal-api</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.atlassian.user</groupId>
      <artifactId>atlassian-user-core</artifactId>
      <scope>provided</scope>
    </dependency>

    <!-- 3rd party dependencies -->
    <dependency>
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>commons-lang</groupId>
      <artifactId>commons-lang</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>io.atlassian.fugue</groupId>
      <artifactId>fugue</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>io.atlassian.util.concurrent</groupId>
      <artifactId>atlassian-util-concurrent</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jaxb</groupId>
      <artifactId>jaxb-runtime</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
       <groupId>org.apache.commons</groupId>
       <artifactId>commons-lang3</artifactId>
       <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.quartz-scheduler</groupId>
      <artifactId>quartz</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.reflections</groupId>
      <artifactId>reflections</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-1.2-api</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.codehaus.jackson</groupId>
      <artifactId>jackson-core-asl</artifactId>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>io.swagger.core.v3</groupId>
      <artifactId>swagger-jaxrs2</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.atlassian.bitbucket.server.swagger</groupId>
      <artifactId>annotations</artifactId>
      <scope>provided</scope>
    </dependency>

    <!-- test dependencies -->
    <dependency>
      <groupId>com.atlassian.bamboo</groupId>
      <artifactId>atlassian-bamboo-pageobjects</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.atlassian.bamboo</groupId>
      <artifactId>atlassian-bamboo-test-utils</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.atlassian.selenium</groupId>
      <artifactId>atlassian-pageobjects-elements</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.rest-assured</groupId>
      <artifactId>rest-assured</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-slf4j-impl</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>pl.pragmatists</groupId>
      <artifactId>JUnitParams</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.woodstox</groupId>
      <artifactId>woodstox-core</artifactId>
      <version>6.3.1</version>
    </dependency>
  </dependencies>

  <profiles>
    <profile>
      <id>restdoc</id>
      <activation>
        <activeByDefault>false</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <executions>
              <execution>
                <phase>pre-site</phase>
                <goals>
                  <goal>compile</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>com.atlassian.bitbucket.server.swagger</groupId>
            <artifactId>swagger-maven-plugin</artifactId>
            <version>${swagger.maven.plugin.version}</version>
            <configuration>
              <resourcePackages>
                <resourcePackage>com.atlassian.bamboo.plugins.rest.admin.agent</resourcePackage>
                <resourcePackage>com.atlassian.bamboo.plugins.rest.admin.artifacthandler</resourcePackage>
                <resourcePackage>com.atlassian.bamboo.plugins.rest.admin.auditlog</resourcePackage>
                <resourcePackage>com.atlassian.bamboo.plugins.rest.admin.buildmonitoring</resourcePackage>
                <resourcePackage>com.atlassian.bamboo.plugins.rest.admin.concurrentbuild</resourcePackage>
                <resourcePackage>com.atlassian.bamboo.plugins.rest.admin.configuration</resourcePackage>
                <resourcePackage>com.atlassian.bamboo.plugins.rest.admin.darkfeature</resourcePackage>
                <resourcePackage>com.atlassian.bamboo.plugins.rest.admin.elasticconfiguration</resourcePackage>
                <resourcePackage>com.atlassian.bamboo.plugins.rest.admin.expiry</resourcePackage>
                <resourcePackage>com.atlassian.bamboo.plugins.rest.admin.globalvariable</resourcePackage>
                <resourcePackage>com.atlassian.bamboo.plugins.rest.admin.group</resourcePackage>
                <resourcePackage>com.atlassian.bamboo.plugins.rest.admin.imserver</resourcePackage>
                <resourcePackage>com.atlassian.bamboo.plugins.rest.admin.mail</resourcePackage>
                <resourcePackage>com.atlassian.bamboo.plugins.rest.admin.quarantine</resourcePackage>
                <resourcePackage>com.atlassian.bamboo.plugins.rest.admin.scheduler</resourcePackage>
                <resourcePackage>com.atlassian.bamboo.plugins.rest.admin.security</resourcePackage>
                <resourcePackage>com.atlassian.bamboo.plugins.rest.admin.user.rename</resourcePackage>
                <resourcePackage>com.atlassian.bamboo.plugins.rest.admin.storage</resourcePackage>
                <resourcePackage>com.atlassian.bamboo.plugins.rest.admin.ssh</resourcePackage>
                <resourcePackage>com.atlassian.bamboo.plugins.rest.build</resourcePackage>
                <resourcePackage>com.atlassian.bamboo.plugins.rest.deployments.environments</resourcePackage>
                <resourcePackage>com.atlassian.bamboo.plugins.rest.deployments.execution</resourcePackage>
                <resourcePackage>com.atlassian.bamboo.plugins.rest.deployments.issues</resourcePackage>
                <resourcePackage>com.atlassian.bamboo.plugins.rest.deployments.projects</resourcePackage>
                <resourcePackage>com.atlassian.bamboo.plugins.rest.deployments.results</resourcePackage>
                <resourcePackage>com.atlassian.bamboo.plugins.rest.deployments.versions</resourcePackage>
                <resourcePackage>com.atlassian.bamboo.plugins.rest.encrypt</resourcePackage>
                <resourcePackage>com.atlassian.bamboo.plugins.rest.permission</resourcePackage>
                <resourcePackage>com.atlassian.bamboo.plugins.rest.resource</resourcePackage>
                <resourcePackage>com.atlassian.bamboo.plugins.rest.user</resourcePackage>
              </resourcePackages>
              <enrichers>
                <enricher>com.atlassian.bamboo.server.swagger.enricher.BambooEnricher</enricher>
              </enrichers>
              <outputDirectory>${project.build.directory}/site</outputDirectory>
              <outputFilename>swagger</outputFilename>
              <outputFormats>JSON,YAML</outputFormats>
              <prettyPrint>true</prettyPrint>
              <swaggerConfig>
                <servers>
                  <server>
                    <url>http://myhost.com:8085/rest/</url>
                    <description>Endpoint URL</description>
                  </server>
                </servers>
              </swaggerConfig>
            </configuration>
            <dependencies>
              <dependency>
                <groupId>com.atlassian.bitbucket.server.swagger</groupId>
                <artifactId>processor</artifactId>
                <version>${bitbucket.swagger.version}</version>
              </dependency>
            </dependencies>
            <executions>
              <execution>
                <phase>compile</phase>
                <goals>
                  <goal>generate</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>release-profile</id>
      <properties>
        <skipTests>true</skipTests>
      </properties>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <skip>true</skip>
              <skipTests>true</skipTests>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <reporting>
    <plugins>
      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
        <configuration>
          <maxmemory>1024m</maxmemory>
        </configuration>
        <reportSets>
          <reportSet>
            <id>default</id>
            <reports>
              <report>aggregate</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
      </plugin>
    </plugins>
  </reporting>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <configuration>
            <inputDirectory>${project.reporting.outputDirectory}/apidocs</inputDirectory>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>com.atlassian.plugin</groupId>
        <artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>com.atlassian.maven.plugins</groupId>
        <artifactId>bamboo-maven-plugin</artifactId>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
            <Spring-Context>*;timeout:=60</Spring-Context>
            <Export-Package>
              com.atlassian.bamboo.plugins.rest.common.*,
              com.atlassian.bamboo.plugins.rest.link.*,
              com.atlassian.bamboo.rest.common.*,
              com.atlassian.bamboo.rest.model.*
            </Export-Package>
            <Import-Package>
              <!-- General Resolution -->
              com.atlassian.analytics.api.annotations;version="0.0.0",
              com.atlassian.analytics.api.services;version="0.0.0",
              com.atlassian.applinks.api;version="0.0.0",
              com.atlassian.aws;version="0.0.0",
              com.atlassian.aws.ec2*;version="0.0.0",
              com.atlassian.bamboo.*;version="0.0.0",
              com.atlassian.core.i18n;version="0.0.0",
              com.atlassian.crowd.integration;version="0.0.0",
              com.atlassian.event.api;version="0.0.0",
              com.atlassian.fugue;version="0.0.0",
              io.atlassian.fugue;version="0.0.0",
              com.atlassian.http.mime,
              com.atlassian.plugin;version="0.0.0",
              com.atlassian.plugins.rest.common*;version="0.0.0",
              com.atlassian.sal.api;version="0.0.0",
              com.atlassian.sal.api.net;version="0.0.0",
              com.atlassian.security.password;version="0.0.0",
              com.atlassian.spring.container;version="0.0.0",
              com.atlassian.struts;version="0.0.0",
              com.atlassian.user;version="0.0.0",
              com.atlassian.user.search*;version="0.0.0",
              com.amazonaws.services.ec2.model;version="0.0.0",
              com.google.common.*;version="0.0.0",
              com.google.gson;version="0.0.0",
              com.opensymphony.module.propertyset;version="0.0.0",
              com.sun.jersey.*;version="0.0.0",
              io.atlassian.util.concurrent;version="0.0.0",
              javax.annotation;version="0.0.0",
              javax.servlet;version="0.0.0",
              javax.servlet.http;version="0.0.0",
              javax.ws.rs;version="0.0.0",
              javax.ws.rs.*;version="0.0.0",
              javax.xml.bind.annotation*;version="0.0.0",
              org.acegisecurity;version="0.0.0",
              org.acegisecurity.acls;version="0.0.0",
              org.apache.commons.*;version="0.0.0",
              org.codehaus.jackson.*;version="0.0.0",
              org.apache.log4j;version="0.0.0",
              org.jfree.data.*;version="0.0.0",
              org.joda.time;version="0.0.0",
              org.joda.time.format;version="0.0.0",
              org.quartz;version="0.0.0",
              *;resolution:=optional
            </Import-Package>
          </instructions>
          <products>
            <product>
              <id>bamboo</id>
              <instanceId>bamboo</instanceId>
              <systemPropertyVariables>
                <atlassian.darkfeature.bamboo.sox.compliance.configurable>true</atlassian.darkfeature.bamboo.sox.compliance.configurable>
                <atlassian.darkfeature.bamboo.improved.admin.panel.nav>true</atlassian.darkfeature.bamboo.improved.admin.panel.nav>
                <bamboo.allow.url.parameters.login>true</bamboo.allow.url.parameters.login>
              </systemPropertyVariables>
            </product>
          </products>
          <pluginArtifacts>
            <pluginArtifact>
              <groupId>com.atlassian.bamboo.plugins</groupId>
              <artifactId>atlassian-bamboo-plugin-test-utils</artifactId>
            </pluginArtifact>
          </pluginArtifacts>
          <testGroups>
            <testGroup>
              <id>bamboo</id>
              <instanceIds>
                <instanceId>bamboo</instanceId>
              </instanceIds>
              <includes>
                <include>it/**/*Test.java</include>
              </includes>
            </testGroup>
          </testGroups>
        </configuration>
      </plugin>
    </plugins>
  </build>

</project>
