<?xml version="1.0"?>
<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one or more
  ~ contributor license agreements.  See the NOTICE file distributed with
  ~ this work for additional information regarding copyright ownership.
  ~ The ASF licenses this file to You under the Apache License, Version 2.0
  ~ (the "License"); you may not use this file except in compliance with
  ~ the License.  You may obtain a copy of the License at
  ~
  ~    http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<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.github.cloudml.zen</groupId>
    <artifactId>zen-parent_2.11</artifactId>
    <version>0.1</version>
    <relativePath>../pom.xml</relativePath>
  </parent>
  <groupId>com.github.cloudml.zen</groupId>
  <artifactId>zen-examples_2.11</artifactId>
  <name>Zen Project Examples</name>
  <url>https://github.com/cloudml/zen/</url>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <dependencies>
    <dependency>
      <groupId>com.github.cloudml.zen</groupId>
      <artifactId>zen-ml_${scala.binary.version}</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.spark</groupId>
      <artifactId>spark-graphx_${scala.binary.version}</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.spark</groupId>
      <artifactId>spark-mllib_${scala.binary.version}</artifactId>
    </dependency>
    <dependency>
      <groupId>com.github.scopt</groupId>
      <artifactId>scopt_${scala.binary.version}</artifactId>
      <version>3.2.0</version>
    </dependency>
    <!-- test -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.novocode</groupId>
      <artifactId>junit-interface</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.scalatest</groupId>
      <artifactId>scalatest_${scala.binary.version}</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <outputDirectory>target/scala-${scala.binary.version}/classes</outputDirectory>
    <testOutputDirectory>target/scala-${scala.binary.version}/test-classes</testOutputDirectory>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <configuration>
          <shadedArtifactAttached>false</shadedArtifactAttached>
          <outputFile>
            ${project.build.directory}/scala-${scala.binary.version}/zen-examples-${project.version}-spark${spark.version}.jar
          </outputFile>
          <artifactSet>
            <includes>
              <include>*:*</include>
            </includes>
            <excludes>
              <exclude>org.apache.spark:*</exclude>
              <exclude>org.slf4j:*</exclude>
              <exclude>log4j:*</exclude>
              <exclude>asm:*</exclude>
              <exclude>commons-logging:*</exclude>
              <exclude>org.scala-lang:*</exclude>
              <exclude>org.apache.hadoop:*</exclude>
              <exclude>org.eclipse.jetty:*</exclude>
              <exclude>com.fasterxml.jackson.core:*</exclude>
              <exclude>org.eclipse.jetty.*:*</exclude>
              <exclude>com.esotericsoftware.*:*</exclude>
              <exclude>com.codahale.*:*</exclude>
              <exclude>javax.*:*</exclude>
              <exclude>org.objectweb.*:*</exclude>
              <exclude>org.apache.zookeeper:*</exclude>
              <exclude>com.google.guava:*</exclude>
              <exclude>com.twitter:*:*</exclude>
              <exclude>org.mockito:*:*</exclude>
              <exclude>*:commons-beanutils</exclude>
              <exclude>org.apache.mesos:*</exclude>
              <exclude>com.google.protobuf:*</exclude>
              <exclude>org.apache.ant:*</exclude>
              <exclude>xmlenc:*</exclude>
              <exclude>hsqldb:*</exclude>
              <exclude>org.scalanlp:*</exclude>
              <exclude>org.apache.commons:*</exclude>
              <exclude>org.jblas:*</exclude>
              <exclude>com.google.code.findbugs:*</exclude>
              <exclude>io.netty:*</exclude>
              <exclude>org.spark-project.akka:*</exclude>
              <exclude>org.spark-project.protobuf:*</exclude>
              <exclude>org.json4s:*</exclude>
              <exclude>org.spark-project:*</exclude>
              <exclude>org.apache.curator:*</exclude>
              <exclude>jline:*</exclude>
              <exclude>com.ning:*</exclude>
              <exclude>org.scala-lang:*:*:*</exclude>
              <exclude>org.apache.hadoop.thirdparty.guava:*</exclude>
            </excludes>
          </artifactSet>
          <filters>
            <filter>
              <artifact>com.google.guava:guava</artifact>
              <excludes>
                <exclude>com/google/common/base/Optional*</exclude>
              </excludes>
            </filter>
            <filter>
              <artifact>*:*</artifact>
              <excludes>
                <exclude>META-INF/*.SF</exclude>
                <exclude>META-INF/*.DSA</exclude>
                <exclude>META-INF/*.RSA</exclude>
              </excludes>
            </filter>
          </filters>
        </configuration>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <transformers>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                  <resource>reference.conf</resource>
                </transformer>
                <transformer implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
                  <resource>log4j.properties</resource>
                </transformer>
              </transformers>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
