<?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>
    <groupId>io.confluent</groupId>
    <artifactId>metadata-service-parent</artifactId>
    <version>7.9.5</version>
  </parent>

  <artifactId>rbac-common</artifactId>
  <packaging>jar</packaging>
  <name>rbac-common</name>

  <properties>
    <concurrent-trees.version>2.6.1</concurrent-trees.version>
    <auto-value.version>1.8.1</auto-value.version>
    <auto-service.version>1.0</auto-service.version>

    <!-- Test Dependencies -->
    <jolt.version>0.1.1</jolt.version>
    <!-- This should match ce-kafka.   We have to specify this here because
         when we pull ce-kafka "test class" dependencies we are doing it via
         "classifier" which does not get us a separate "test" transitive
         dependency graph. -->
    <apacheDirectoryServer.version>2.0.0-M24</apacheDirectoryServer.version>

    <!-- ####  CCloud cc-rbac build dependencies #### -->
    <!-- That should not be here / should move out when cc-rbac moves out to it's own
         module. -->
    <!-- LaunchDarkly, and events-schema should also move out, but thos versions are not
         specified here because rbac-extractor also uses them.-->

    <!-- Some Protobufs have to be dual dropped to events-schema and ce-kakfa
         so, we may need to bump this version as ce-kafka updates and we get
         protobuf related build/test breaks.
     -->

  </properties>

  <dependencies>
    <dependency>
      <groupId>io.confluent</groupId>
      <artifactId>rest-utils</artifactId>
      <version>${io.confluent.rest-utils.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.apache.kafka</groupId>
          <artifactId>*</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>io.confluent</groupId>
      <artifactId>kafka-client-plugins</artifactId>
      <version>${ce.kafka.version}</version>
      <scope>compile</scope>
      <exclusions>
        <exclusion>
          <groupId>org.bouncycastle</groupId>
          <artifactId>bc-fips</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>io.confluent</groupId>
      <artifactId>confluent-security-plugins-common</artifactId>
      <version>${io.confluent.confluent-security-plugins.version}</version>
      <exclusions>
        <exclusion>
          <groupId>io.confluent</groupId>
          <artifactId>confluent-licensing-new</artifactId>
        </exclusion>
        <exclusion>
          <!-- Don't need to pull in the Schema Registry Client -->
          <groupId>io.confluent</groupId>
          <artifactId>kafka-schema-registry-client</artifactId>
        </exclusion>
        <!-- confluent-security-plugins pulls in cc-security-decisions-client, which
             pulls in these 3 log4j dependencies, which causes JWTDebugLoggingTest to fail -->
        <exclusion>
          <groupId>org.apache.logging.log4j</groupId>
          <artifactId>log4j-core</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.logging.log4j</groupId>
          <artifactId>log4j-api</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.logging.log4j</groupId>
          <artifactId>log4j-slf4j-impl</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.bouncycastle</groupId>
          <artifactId>bc-fips</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <!-- Roles -->
      <groupId>io.confluent</groupId>
      <artifactId>rbac</artifactId>
      <version>${ce.kafka.version}</version>
      <exclusions>
        <exclusion>
          <groupId>io.confluent</groupId>
          <artifactId>cc-role-definitions</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>io.confluent</groupId>
      <artifactId>cc-role-definitions</artifactId>
      <version>${cc.role.definitions.version}</version>
    </dependency>

    <dependency>
      <!-- Jersey uses Java Logging, this dependency allows us to control Jersey's logging
          from our log4j.properties file so that we can turn _off_ the
          Jersey dependency injection "providers" warnings and redirect logs to slf4j loggers -->
      <groupId>org.slf4j</groupId>
      <artifactId>jul-to-slf4j</artifactId>
      <version>${slf4j.version}</version>
    </dependency>

    <dependency>
      <!-- AuthStore, AuthWriter -->
      <groupId>io.confluent</groupId>
      <artifactId>auth-providers</artifactId>
      <version>${ce.kafka.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-log4j12</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.bouncycastle</groupId>
          <artifactId>bcpkix-jdk15on</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.kafka</groupId>
          <artifactId>connect-runtime</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.commons</groupId>
          <artifactId>commons-lang3</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.apache.kafka</groupId>
      <artifactId>kafka_${kafka.scala.version}</artifactId>
      <version>${ce.kafka.version}</version>
    </dependency>

    <dependency>
      <!-- KafkaPrincipal -->
      <groupId>org.apache.kafka</groupId>
      <artifactId>kafka-clients</artifactId>
      <version>${ce.kafka.version}</version>
    </dependency>

    <dependency>
      <groupId>io.confluent</groupId>
      <artifactId>auth-metadata</artifactId>
      <version>${ce.kafka.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.apache.kafka</groupId>
          <artifactId>connect-runtime</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>io.confluent</groupId>
      <artifactId>confluent-resource-names</artifactId>
      <version>${ce.kafka.version}</version>
    </dependency>

    <dependency>
      <groupId>io.confluent</groupId>
      <artifactId>auth-providers</artifactId>
      <version>${ce.kafka.version}</version>
      <classifier>test</classifier>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>io.confluent</groupId>
      <artifactId>confluent-audit</artifactId>
      <version>${ce.kafka.version}</version>
      <exclusions>
        <exclusion>
          <groupId>io.confluent</groupId>
          <artifactId>broker-plugins</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>io.confluent</groupId>
      <artifactId>ce-kafka-http-server</artifactId>
      <version>${io.confluent.ce-kafka-http-server.version}</version>
    </dependency>

    <dependency>
      <groupId>io.confluent</groupId>
      <artifactId>broker-plugins</artifactId>
      <version>${ce.kafka.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-log4j12</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.bouncycastle</groupId>
          <artifactId>bcpkix-jdk18on</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.bouncycastle</groupId>
          <artifactId>bc-fips</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>io.confluent.security</groupId>
      <artifactId>security-extensions</artifactId>
      <version>${ce.kafka.version}</version>
    </dependency>

    <dependency>
      <groupId>io.confluent</groupId>
      <artifactId>testing-ldap</artifactId>
      <version>${confluent.version.range}</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.bouncycastle</groupId>
          <artifactId>bcprov-jdk15on</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>${guava.version}</version>
    </dependency>

    <dependency>
      <groupId>org.testng</groupId>
      <artifactId>testng</artifactId>
      <version>${testng.version}</version>
    </dependency>

    <dependency>
      <!-- For bean validation annotations ala @V1ValidScope -->
      <groupId>org.glassfish.jersey.ext</groupId>
      <artifactId>jersey-bean-validation</artifactId>
    </dependency>

    <!-- ce-kafka plugin runtime dependencies -->
    <dependency>
      <groupId>com.fasterxml.jackson.datatype</groupId>
      <artifactId>jackson-datatype-jsr310</artifactId>
      <!-- We don't specify a version here, because we want this to be
           inherited from an ancestor pom. Further, jackson bom maybe
           ahead of ${jackson.version} with additional security patches,
           which is why we just skip it entirely -->
    </dependency>

    <dependency>
      <!-- Nice implementation of a RadixTree, used in the Manage Rolebindings of others
           apis. -->
      <groupId>com.googlecode.concurrent-trees</groupId>
      <artifactId>concurrent-trees</artifactId>
      <version>${concurrent-trees.version}</version>
    </dependency>

    <dependency>
      <!-- For Diffy and general JSON handling -->
      <groupId>com.bazaarvoice.jolt</groupId>
      <artifactId>json-utils</artifactId>
      <version>${jolt.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.bitbucket.b_c</groupId>
      <artifactId>jose4j</artifactId>
    </dependency>

    <dependency>
      <groupId>com.squareup.retrofit2</groupId>
      <artifactId>retrofit</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.junit.vintage</groupId>
      <artifactId>junit-vintage-engine</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.kafka</groupId>
      <artifactId>kafka-clients</artifactId>
      <classifier>test</classifier>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <!-- Suppress the Junit Integration test group definition inherited from common
             by forcing only our/this configuration to be used.
             Means we have to duplicate the skipUnitTests featuure. -->
        <configuration combine.self="override">
          <useModulePath>false</useModulePath>
          <argLine>@{argLine}</argLine>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.apache.maven.surefire</groupId>
            <artifactId>surefire-testng</artifactId>
            <version>${maven-surefire-plugin-module.version}</version>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <!-- Suppress the Junit Integration test group definition inherited from common, as
             TestNG will see it an try to respect it.  -->
        <configuration combine.self="override">

          <!--
          This is required when building with jdk 11 and failsafe 3.0.0-M5 when
            there is more than one test suite.
          With jdk 11, it wants to use fancy new jdk 9 "module" logic by default.
            see https://github.com/openzipkin/zipkin/issues/3159
          -->
          <useModulePath>false</useModulePath>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.apache.maven.surefire</groupId>
            <artifactId>surefire-testng</artifactId>
            <version>${maven-surefire-plugin-module.version}</version>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${jacoco-maven-plugin.version}</version>
        <executions>
          <execution>
            <id>generate-code-coverage-report</id>
            <phase>test</phase>
            <configuration>
              <skip>${skipTests}</skip>
            </configuration>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <descriptors>
            <descriptor>src/assembly/package.xml</descriptor>
          </descriptors>
        </configuration>
        <executions>
          <execution>
            <id>make-assembly</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

</project>
