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

  <groupId>io.confluent</groupId>
  <artifactId>cc-role-definitions-parent</artifactId>
  <name>cc-role-definitions</name>
  <version>7.8.4</version>

  <packaging>pom</packaging>

  <organization>
    <name>Confluent, Inc.</name>
    <url>http://confluent.io</url>
  </organization>
  <url>http://confluent.io</url>
  <description>
    Cloud Role Definitions for Confluent Cloud
  </description>

  <licenses>
    <license>
      <name>Confluent License Agreement</name>
      <url>https://www.confluent.io/legal/confluent-license-agreement/</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <modules>
    <module>role-definitions</module>
  </modules>

  <properties>
    <!--used by io.confluent:common in maven-compiler-plugin-->
    <java.version>8</java.version>
    <maven-compiler-plugin.version>3.10.0</maven-compiler-plugin.version>
    <maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
    <buildnumber-plugin.version>1.4</buildnumber-plugin.version>
    <maven-checkstyle-plugin.version>3.1.2</maven-checkstyle-plugin.version>
    <checkstyle.version>9.3</checkstyle.version>
    <checkstyle.config.location>checkstyle/checkstyle.xml</checkstyle.config.location>
    <checkstyle.suppressions.location>checkstyle/common-suppressions.xml
    </checkstyle.suppressions.location>
    <!-- true in ci builds-->
    <dependency.check.skip>true</dependency.check.skip>
    <dependency.check.version>7.4.4</dependency.check.version>
    <dependency.check.suppressions.location>dependency-check/suppressions.xml
    </dependency.check.suppressions.location>
    <!-- pin to some version, doesn't change much -->
    <io.confluent.common.version>7.7.0</io.confluent.common.version>
    <maven-enforcer-plugin.version>3.0.0-M3</maven-enforcer-plugin.version>
    <maven-deploy.version>2.8.2</maven-deploy.version>
    <required.maven.version>3.2</required.maven.version>
    <io.confluent.cc-role-definitions.version>7.8.4</io.confluent.cc-role-definitions.version>
    <spotbugs.maven.version>4.8.6.6</spotbugs.maven.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-annotations</artifactId>
      <version>2.16.2</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>2.16.2</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.datatype</groupId>
      <artifactId>jackson-datatype-jdk8</artifactId>
      <version>2.16.2</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.dataformat</groupId>
      <artifactId>jackson-dataformat-yaml</artifactId>
      <version>2.16.2</version>
    </dependency>

    <!--test-->
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <version>5.7.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-params</artifactId>
      <version>5.7.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.reflections</groupId>
      <artifactId>reflections</artifactId>
      <version>0.10.2</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <scm>
    <connection>scm:git:git://github.com/confluentinc/cc-rbac-services.git</connection>
    <developerConnection>scm:git:git@github.com:confluentinc/cc-rbac-services.git
    </developerConnection>
    <url>https://github.com/confluentinc/cc-rbac-services</url>
    <tag>HEAD</tag>
  </scm>

  <repositories>
    <repository>
      <id>confluent</id>
      <name>Confluent</name>
      <url>https://packages.confluent.io/maven/</url>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>confluent</id>
      <url>https://packages.confluent.io/maven/</url>
    </pluginRepository>
  </pluginRepositories>

  <distributionManagement>
    <repository>
      <id>aws-release</id>
      <name>AWS Release Repository</name>
      <url>${confluent.release.repo}</url>
    </repository>
    <snapshotRepository>
      <id>aws-snapshot</id>
      <name>AWS Snapshot Repository</name>
      <url>${confluent.snapshot.repo}</url>
    </snapshotRepository>
  </distributionManagement>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <version>${maven-checkstyle-plugin.version}</version>
          <configuration>
            <configLocation>${checkstyle.config.location}</configLocation>
            <suppressionsLocation>${checkstyle.suppressions.location}</suppressionsLocation>
            <sourceDirectories>
              <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
            </sourceDirectories>
            <encoding>UTF-8</encoding>
            <consoleOutput>true</consoleOutput>
            <failsOnError>true</failsOnError>
            <failOnViolation>true</failOnViolation>
            <includeResources>false</includeResources>
            <includeTestResources>false</includeTestResources>
          </configuration>
          <dependencies>
            <dependency>
              <groupId>io.confluent</groupId>
              <artifactId>build-tools</artifactId>
              <version>${io.confluent.common.version}</version>
            </dependency>
            <dependency>
              <groupId>com.puppycrawl.tools</groupId>
              <artifactId>checkstyle</artifactId>
              <version>${checkstyle.version}</version>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>${maven-compiler-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>${maven-jar-plugin.version}</version>
          <configuration>
            <archive>
              <manifestEntries>
                <Commit-ID>${gitCommitID}</Commit-ID>
              </manifestEntries>
            </archive>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>${maven-enforcer-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>buildnumber-maven-plugin</artifactId>
          <version>${buildnumber-plugin.version}</version>
          <executions>
            <execution>
              <phase>validate</phase>
              <goals>
                <goal>create</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <doCheck>false</doCheck>
            <doUpdate>false</doUpdate>
            <buildNumberPropertyName>gitCommitID</buildNumberPropertyName>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <inherited>true</inherited>
        <configuration>
          <source>${java.version}</source>
          <target>${java.version}</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>test-jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>buildnumber-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <executions>
          <execution>
            <id>validate</id>
            <phase>validate</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <execution>
            <id>enforce-versions</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireMavenVersion>
                  <version>${required.maven.version}</version>
                </requireMavenVersion>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!-- This plugin generates the aggregate SBOM of the project
          including ALL the required dependencies. The source based SBOMs
          are required for Dependency Mirrors, EOL and full accounting
          of components used in Confluent's portfolio -->
      <plugin>
        <groupId>org.cyclonedx</groupId>
        <artifactId>cyclonedx-maven-plugin</artifactId>
        <version>2.7.9</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>makeAggregateBom</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <projectType>library</projectType>
          <schemaVersion>1.4</schemaVersion>
          <includeBomSerialNumber>true</includeBomSerialNumber>
          <includeCompileScope>true</includeCompileScope>
          <includeProvidedScope>true</includeProvidedScope>
          <includeRuntimeScope>true</includeRuntimeScope>
          <includeSystemScope>true</includeSystemScope>
          <includeTestScope>true</includeTestScope>
          <includeLicenseText>false</includeLicenseText>
          <outputReactorProjects>true</outputReactorProjects>
          <outputFormat>all</outputFormat>
          <outputName>bom</outputName>
        </configuration>
      </plugin>
    </plugins>
    <extensions>
      <extension>
        <groupId>io.confluent</groupId>
        <artifactId>aws-maven</artifactId>
        <version>1.0.0</version>
      </extension>
    </extensions>
  </build>


  <profiles>
    <profile>
      <id>jenkins</id>
      <activation>
        <property>
          <name>env.BUILD_NUMBER</name>
        </property>
      </activation>
      <properties>
        <dependency.check.skip>false</dependency.check.skip>
        <!-- During CI builds we do not want to execute the resolver plugin
            or the additional install and deploy steps as they are only
            needed when building locally.
        -->
        <skip.maven.resolver.plugin>true</skip.maven.resolver.plugin>
        <custom.install.phase>none</custom.install.phase>
        <custom.deploy.phase>none</custom.deploy.phase>
        <!-- During CI builds we need to fail if we are unable to resolve
            the latest version of ce-kafka artifacts.
        -->
        <fail.if.ce-kafka.version.not.found>true</fail.if.ce-kafka.version.not.found>
      </properties>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.jacoco</groupId>
              <artifactId>jacoco-maven-plugin</artifactId>
            </plugin>
          </plugins>
        </pluginManagement>
        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>pre-unit-test</id>
                <goals>
                  <goal>prepare-agent</goal>
                </goals>
              </execution>
              <execution>
                <id>report</id>
                <phase>verify</phase>
                <goals>
                  <goal>report</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-checkstyle-plugin</artifactId>
          </plugin>
          <plugin>
            <groupId>com.github.spotbugs</groupId>
            <artifactId>spotbugs-maven-plugin</artifactId>
            <version>${spotbugs.maven.version}</version>
            <configuration>
              <effort>Max</effort>
              <threshold>High</threshold>
              <xmlOutput>true</xmlOutput>
            </configuration>
            <executions>
              <execution>
                <goals>
                  <goal>check</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
      <reporting>
        <plugins>
          <plugin>
            <groupId>com.github.spotbugs</groupId>
            <artifactId>spotbugs-maven-plugin</artifactId>
            <version>${spotbugs.maven.version}</version>
            <configuration>
              <xmlOutput>true</xmlOutput>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-checkstyle-plugin</artifactId>
            <configuration>
              <configLocation>${checkstyle.config.location}</configLocation>
              <suppressionsLocation>${checkstyle.suppressions.location}</suppressionsLocation>
              <sourceDirectories>
                <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
              </sourceDirectories>
              <encoding>UTF-8</encoding>
              <consoleOutput>true</consoleOutput>
              <failsOnError>false</failsOnError>
              <failOnViolation>true</failOnViolation>
              <includeResources>false</includeResources>
              <includeTestResources>false</includeTestResources>
            </configuration>
            <reportSets>
              <reportSet>
                <reports>
                  <report>checkstyle-aggregate</report>
                </reports>
              </reportSet>
            </reportSets>
          </plugin>
        </plugins>
      </reporting>
    </profile>
    <profile>
      <!-- org.owasp:dependency-check-maven >= 4.0.0 will not work with JDK7 so it must be activated in a JDK>=1.8 profile.
           Developers can always pass -Ddependency.check.skip=true on the CLI to speed things up during development -->
      <id>dependency-check</id>
      <activation>
        <jdk>[1.8,)</jdk>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.owasp</groupId>
            <artifactId>dependency-check-maven</artifactId>
            <version>${dependency.check.version}</version>
            <dependencies>
              <dependency>
                <groupId>io.confluent</groupId>
                <artifactId>build-tools</artifactId>
                <version>${io.confluent.common.version}</version>
              </dependency>
            </dependencies>
            <configuration>
              <suppressionFiles>
                <suppressionFile>${dependency.check.suppressions.location}</suppressionFile>
              </suppressionFiles>
              <cveUrlModified>
                https://s3-us-west-2.amazonaws.com/confluent-packaging-tools-891377121322-us-west-2/nvd.nist.gov/nvdcve-1.1-modified.json.gz
              </cveUrlModified>
              <cveUrlBase>
                https://s3-us-west-2.amazonaws.com/confluent-packaging-tools-891377121322-us-west-2/nvd.nist.gov/nvdcve-1.1-%d.json.gz
              </cveUrlBase>
              <!-- Don't use this except in special circumstances as a way to disable this check on the command
                   line. Downstream projects should all be running this as part of their normal builds and should
                   not override this flag in their pom file. -->
              <skip>${dependency.check.skip}</skip>
              <skipSystemScope>true</skipSystemScope>
              <skipProvidedScope>true</skipProvidedScope>
              <skipTestScope>true</skipTestScope>
              <format>xml</format>
              <assemblyAnalyzerEnabled>false</assemblyAnalyzerEnabled>
              <ossindexAnalyzerEnabled>false</ossindexAnalyzerEnabled>
            </configuration>
            <executions>
              <execution>
                <goals>
                  <goal>check</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>java-9+</id>
      <activation>
        <jdk>[9,)</jdk>
      </activation>
      <build>
        <plugins>
          <!-- Use release instead of source/target in Java 9 or higher -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <inherited>true</inherited>
            <configuration>
              <release>${java.version}</release>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
