<?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 -->
  <parent>
    <groupId>io.stargate</groupId>
    <artifactId>stargate</artifactId>
    <version>2.0.51</version>
  </parent>
  <!-- Artifact props -->
  <groupId>io.stargate.auth.api</groupId>
  <artifactId>auth-api</artifactId>
  <name>Stargate - Coordinator - Auth API</name>
  <properties>
    <osgi.bundle.version>${project.version}</osgi.bundle.version>
  </properties>
  <dependencies>
    <!-- Stargate component dependencies -->
    <dependency>
      <groupId>io.stargate.core</groupId>
      <artifactId>core</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>io.stargate.auth</groupId>
      <artifactId>authnz</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>io.stargate.metrics</groupId>
      <artifactId>metrics-jersey</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>io.stargate.db</groupId>
      <artifactId>persistence-api</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
    </dependency>
    <!-- 3rd party dependencies -->
    <dependency>
      <groupId>io.dropwizard</groupId>
      <artifactId>dropwizard-jersey</artifactId>
    </dependency>
    <dependency>
      <groupId>io.dropwizard</groupId>
      <artifactId>dropwizard-core</artifactId>
    </dependency>
    <dependency>
      <groupId>io.dropwizard</groupId>
      <artifactId>dropwizard-logging</artifactId>
    </dependency>
    <dependency>
      <groupId>io.swagger</groupId>
      <artifactId>swagger-jersey2-jaxrs</artifactId>
      <version>${swagger-jersey2-jaxrs.version}</version>
    </dependency>
    <!-- Test dependencies -->
    <dependency>
      <groupId>io.dropwizard</groupId>
      <artifactId>dropwizard-testing</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <!-- Download swagger-ui resources jar -->
        <artifactId>maven-dependency-plugin</artifactId>
        <version>3.1.1</version>
        <executions>
          <execution>
            <phase>prepare-package</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.webjars</groupId>
                  <artifactId>swagger-ui</artifactId>
                  <version>${swagger-ui.version}</version>
                </artifactItem>
              </artifactItems>
              <outputDirectory>${project.build.directory}/swagger-ui</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!-- Copy swagger-ui resources to target resources -->
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>3.1.0</version>
        <executions>
          <execution>
            <id>copy-resources</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}/classes/swagger-ui</outputDirectory>
              <resources>
                <resource>
                  <directory>${project.build.directory}/swagger-ui/META-INF/resources/webjars/swagger-ui/${swagger-ui.version}</directory>
                  <filtering>true</filtering>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <configuration>
          <unpackBundle>true</unpackBundle>
          <instructions>
            <Bundle-Name>AuthApi</Bundle-Name>
            <Bundle-Description>Auth API for Stargate project</Bundle-Description>
            <Bundle-SymbolicName>io.stargate.auth.api</Bundle-SymbolicName>
            <Bundle-Activator>io.stargate.auth.api.AuthApiActivator</Bundle-Activator>
            <Embed-Transitive>true</Embed-Transitive>
            <Import-Package><![CDATA[
                            org.slf4j,
                            org.slf4j.helpers,
                            org.slf4j.spi,
                            !io.dropwizard.logging,
                            io.stargate.core,
                            org.osgi.framework,
                            com.codahale.metrics,
                            io.stargate.auth
                        ]]></Import-Package>
            <Export-Package>!*</Export-Package>
            <DynamicImport-Package>*</DynamicImport-Package>
            <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
          </instructions>
          <buildDirectory>${project.basedir}/../stargate-lib</buildDirectory>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
          </archive>
          <outputDirectory>${project.basedir}/../stargate-lib</outputDirectory>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
