<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>com.hotels</groupId>
    <artifactId>circus-train-parent</artifactId>
    <version>16.4.1</version>
  </parent>

  <artifactId>circus-train</artifactId>
  <name>CT packager</name>
  <description>Packages Circus Train for deployment.</description>
  <packaging>pom</packaging>

  <dependencies>
    <dependency>
      <groupId>com.hotels</groupId>
      <artifactId>circus-train-core</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>com.hotels</groupId>
      <artifactId>circus-train-distcp-copier</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>com.hotels</groupId>
      <artifactId>circus-train-s3-mapreduce-cp-copier</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>com.hotels</groupId>
      <artifactId>circus-train-s3-s3-copier</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>com.hotels</groupId>
      <artifactId>circus-train-housekeeping</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>com.hotels</groupId>
      <artifactId>circus-train-metrics</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>com.hotels</groupId>
      <artifactId>circus-train-s3-mapreduce-cp</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>com.hotels</groupId>
      <artifactId>circus-train-gcp</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>com.hotels</groupId>
      <artifactId>circus-train-hive-view</artifactId>
      <version>${project.version}</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>${maven-shade-plugin.version}</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <shadedArtifactAttached>false</shadedArtifactAttached>
              <outputFile>target/circus-train-${project.version}-all.jar</outputFile>
              <artifactSet>
                <includes>
                  <include>com.hotels:*</include>
                  <include>com.google.cloud*:*</include>
                  <include>com.google.api*:*</include>
                  <include>com.google.oauth*:*</include>
                  <include>com.google.http*:*</include>
                  <include>com.google.guava:guava</include>
                  <include>com.jcraft:*</include>
                  <include>com.pastdev:jsch-extension</include>
                  <include>io.dropwizard.metrics:*</include>
                  <include>com.amazonaws:*</include>
                  <include>org.apache.httpcomponents:*</include>
                  <include>com.fasterxml.jackson.*:*</include>
                  <include>com.github.ulisesbocchio:*</include>
                </includes>
              </artifactSet>
              <relocations>
                <relocation>
                  <pattern>com.google.common</pattern>
                  <shadedPattern>${shade.prefix}.com.google.common</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>com.jcraft</pattern>
                  <shadedPattern>${shade.prefix}.com.jcraft</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>com.pastdev</pattern>
                  <shadedPattern>${shade.prefix}.com.pastdev</shadedPattern>
                </relocation>
                <relocation><!-- Note the io.dropwizard groupId above in the includes but package is com.codahale -->
                  <pattern>com.codahale.metrics</pattern>
                  <shadedPattern>${shade.prefix}.com.codahale.metrics</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>com.amazonaws</pattern>
                  <shadedPattern>${shade.prefix}.com.amazonaws</shadedPattern>
                </relocation>
                <relocation><!-- Note org.apache.httpcomponents groupId above in the includes but org.apache.http package, 
                    this is relocated due
                    to newer version used by com.amazonaws, older version is provided by /usr/lib/hive/ -->
                  <pattern>org.apache.http</pattern>
                  <shadedPattern>${shade.prefix}.org.apache.http</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>com.fasterxml.jackson</pattern>
                  <shadedPattern>${shade.prefix}.com.fasterxml.jackson</shadedPattern>
                </relocation>
              </relocations>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>${maven-assembly-plugin.version}</version>
        <configuration>
          <tarLongFileMode>posix</tarLongFileMode>
        </configuration>
        <executions>
          <execution>
            <id>make-assembly</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <descriptors>
                <descriptor>src/main/assembly/circus-train-package.xml</descriptor>
              </descriptors>
              <appendAssemblyId>true</appendAssemblyId>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
