<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2016 Red Hat, Inc. and others. All rights reserved.

This program and the accompanying materials are made available under the
terms of the Eclipse Public License v1.0 which accompanies this distribution,
and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
-->
<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>org.opendaylight.aaa</groupId>
    <artifactId>aaa-parent</artifactId>
    <version>0.21.3</version>
    <relativePath>../parent/pom.xml</relativePath>
  </parent>

  <artifactId>aaa-cli-jar</artifactId>
  <name>ODL :: aaa :: ${project.artifactId}</name>
  <packaging>jar</packaging>

  <dependencies>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
    </dependency>
    <dependency>
      <groupId>net.sf.jopt-simple</groupId>
      <artifactId>jopt-simple</artifactId>
      <version>5.0.4</version>
    </dependency>
    <dependency>
      <groupId>org.opendaylight.aaa</groupId>
      <artifactId>aaa-idm-store-h2</artifactId>
      <exclusions>
        <exclusion>
          <!-- Completely disable transitive dependencies -->
          <groupId>*</groupId>
          <artifactId>*</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <!-- Now repeat the few really needed dependencies which we would normally get transitively -->
    <dependency>
      <groupId>org.opendaylight.aaa</groupId>
      <artifactId>aaa-authn-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-text</artifactId>
    </dependency>
    <dependency>
      <groupId>com.h2database</groupId>
      <artifactId>h2</artifactId>
      <scope>compile</scope>
    </dependency>

    <!-- Now for the FAT JAR we need to fix up some <scope>provided to be <scope>compile -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <scope>compile</scope> <!-- Not provided -->
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <scope>compile</scope> <!-- Not test -->
    </dependency>
    <!-- Testing Dependencies -->
    <dependency>
      <groupId>org.opendaylight.yangtools</groupId>
      <artifactId>testutils</artifactId>
    </dependency>
    <dependency>
      <groupId>org.opendaylight.aaa</groupId>
      <artifactId>aaa-password-service-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.opendaylight.aaa</groupId>
      <artifactId>aaa-password-service-impl</artifactId>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-failsafe-plugin</artifactId>
        <!-- TODO Remove when https://git.opendaylight.org/gerrit/#/c/48400/ is merged -->
        <executions>
          <execution>
            <id>integration-test</id>
            <goals>
              <goal>integration-test</goal>
            </goals>
          </execution>
          <execution>
            <id>verify</id>
            <goals>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <executions>
          <execution>
            <id>shade</id>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <createDependencyReducedPom>false</createDependencyReducedPom>
              <minimizeJar>true</minimizeJar>
              <filters>
                  <filter>
                    <artifact>*:*</artifact>
                    <excludes>
                      <exclude>META-INF/*.SF</exclude>
                      <exclude>META-INF/*.DSA</exclude>
                      <exclude>META-INF/*.RSA</exclude>
                    </excludes>
                  </filter>
                <filter>
                  <artifact>org.opendaylight.aaa:aaa-shiro</artifact>
                  <includes>
                    <include>org/opendaylight/**</include>
                  </includes>
                </filter>
                <filter>
                  <artifact>com.h2database:h2</artifact>
                  <excludes>
                    <!-- AAA cli does not use bnf, fulltext, jdbcx, jmx, server and tools -->
                    <exclude>org/h2/bnf/**</exclude>
                    <exclude>org/h2/fulltext/**</exclude>
                    <exclude>org/h2/jdbcx/**</exclude>
                    <exclude>org/h2/jmx/**</exclude>
                    <exclude>org/h2/server/**</exclude>
                    <exclude>org/h2/tools/**</exclude>
                  </excludes>
                </filter>
                <filter>
                  <artifact>org.opendaylight.aaa:aaa-password-service-api</artifact>
                  <includes>
                    <include>org/opendaylight/**</include>
                  </includes>
                </filter>
                <filter>
                  <artifact>org.opendaylight.aaa:aaa-password-service-impl</artifact>
                  <includes>
                    <include>org/opendaylight/**</include>
                  </includes>
                </filter>
              </filters>
              <transformers>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <mainClass>org.opendaylight.aaa.cli.jar.Main</mainClass>
                </transformer>
              </transformers>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

</project>
