<?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">
  <parent>
    <artifactId>metadata-service-parent</artifactId>
    <groupId>io.confluent</groupId>
    <version>8.1.3</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>

  <artifactId>testing-ldap-cli</artifactId>
  <packaging>jar</packaging>
  <name>testing-ldap-cli</name>

  <description>
    Provides a cli to start and manage the in-memory testing ldap server
  </description>

  <dependencies>
    <dependency>
      <groupId>io.confluent</groupId>
      <artifactId>testing-ldap</artifactId>
      <version>${io.confluent.metadata-service.version}</version>
    </dependency>

    <dependency>
      <groupId>net.sourceforge.argparse4j</groupId>
      <artifactId>argparse4j</artifactId>
    </dependency>

    <!-- TEST - Tools -->
    <dependency>
      <groupId>io.confluent</groupId>
      <artifactId>mds-test-tools</artifactId>
      <version>${io.confluent.metadata-service.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>


  <build>
    <finalName>simple-ldap</finalName>
    <plugins>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration combine.self="override">
          <skip>${skipUnitTests}</skip>  <!-- ability to just skip unit tests -->
          <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>
        <configuration combine.self="override">

          <!-- For this project there are no integration tests. -->
          <skipITs>true</skipITs>
        </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>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <!-- can't use <minimizeJar>true</minimizeJar> as ApacheDS loads some classes
                   via Class.forName -->

              <!-- Publish the shaded jar, but don't have it overwrite the "normal" jar.
                   Instead publish it with a different classifier of "runnableJar".
               -->
               <shadedArtifactId>simple-ldap</shadedArtifactId>
              <shadedArtifactAttached>true</shadedArtifactAttached>
              <shadedClassifierName>runnableJar</shadedClassifierName> <!-- Any name that makes sense -->
              <filters>
                <filter>
                  <artifact>*:*</artifact>
                  <excludes>
                    <exclude>META-INF/*.SF</exclude>
                    <exclude>META-INF/*.DSA</exclude>
                    <exclude>META-INF/*.RSA</exclude>
                  </excludes>
                </filter>
              </filters>
              <transformers>
                <transformer
                  implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <mainClass>io.confluent.testing.ldap.cli.LdapCli</mainClass>
                </transformer>
              </transformers>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>


</project>