<?xml version="1.0" encoding="UTF-8"?>
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ~ Copyright (C) 2015 Google Inc.
  ~
  ~ Licensed 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.google.cloud.dataflow</groupId>
    <artifactId>google-cloud-dataflow-java-sdk-parent</artifactId>
    <version>1.8.1</version>
  </parent>

  <groupId>com.google.cloud.dataflow</groupId>
  <artifactId>google-cloud-dataflow-java-examples-all</artifactId>
  <name>Google Cloud Dataflow Java Examples - All</name>
  <description>Google Cloud Dataflow Java SDK provides a simple, Java-based
    interface for processing virtually any size data using Google cloud
    resources. This artifact includes all Dataflow Java SDK
    examples.</description>
  <url>http://cloud.google.com/dataflow</url>

  <packaging>jar</packaging>

  <profiles>
    <profile>
      <id>DataflowPipelineTests</id>
      <properties>
        <runIntegrationTestOnService>true</runIntegrationTestOnService>
        <testGroups>com.google.cloud.dataflow.sdk.testing.RunnableOnService</testGroups>
        <testParallelValue>both</testParallelValue>
      </properties>
    </profile>

    <profile>
      <id>java8</id>
      <activation>
        <jdk>[1.8,)</jdk>
      </activation>

      <build>
        <plugins>
          <!-- Tells Maven about the Java 8 main and test source root. -->
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>add-java8-main-source</id>
                <phase>initialize</phase>
                <goals>
                  <goal>add-source</goal>
                </goals>
                <configuration>
                  <sources>
                    <source>${project.basedir}/src/main/java8</source>
                  </sources>
                </configuration>
              </execution>

              <execution>
                <id>add-java8-test-source</id>
                <phase>initialize</phase>
                <goals>
                  <goal>add-test-source</goal>
                </goals>
                <configuration>
                  <sources>
                    <source>${project.basedir}/src/test/java8</source>
                  </sources>
                </configuration>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <executions>

              <!-- Set `-source 1.7 -target 1.7` for Java 7 tests -->
              <execution>
                <id>default-testCompile</id>
                <phase>test-compile</phase>
                <goals>
                  <goal>testCompile</goal>
                </goals>
                <configuration>
                  <testSource>1.7</testSource>
                  <testTarget>1.7</testTarget>
                  <testExcludes>
                    <!-- This pattern is brittle; we would prefer to filter on the directory
                         but that seems to be unavailable to us. -->
                    <exclude>**/*Java8Test.java</exclude>
                    <exclude>**/game/**/*.java</exclude>
                  </testExcludes>
                </configuration>
              </execution>

              <!-- Set `-source 1.8 -target 1.8` for Java 8 tests -->
              <execution>
                <id>java8-test-compile</id>
                <phase>test-compile</phase>
                <goals>
                  <goal>testCompile</goal>
                </goals>
                <configuration>
                  <testSource>1.8</testSource>
                  <testTarget>1.8</testTarget>
                  <includes>
                    <!-- This pattern is brittle; we would prefer to filter on the directory
                         but that seems to be unavailable to us. -->
                    <include>**/*Java8Test.java</include>
                    <include>**/game/**/*.java</include>
                  </includes>
                </configuration>
              </execution>

              <!-- Set `-source 1.7 -target 1.7` for Java 7 examples -->
              <execution>
                <id>default-compile</id>
                <phase>compile</phase>
                <goals>
                  <goal>compile</goal>
                </goals>
                <configuration>
                  <source>1.7</source>
                  <target>1.7</target>
                  <excludes>
                    <!-- This pattern is brittle; we would prefer to filter on the directory
                         but that seems to be unavailable to us. -->
                    <exclude>**/*Java8*.java</exclude>
                    <exclude>**/game/**/*.java</exclude>
                  </excludes>
                </configuration>
              </execution>

              <!-- Set `-source 1.8 -target 1.8` for Java 8 examples -->
              <execution>
                <id>java8-compile</id>
                <phase>compile</phase>
                <goals>
                  <goal>compile</goal>
                </goals>
                <configuration>
                  <source>1.8</source>
                  <target>1.8</target>
                  <includes>
                    <!-- This pattern is brittle; we would prefer to filter on the directory
                         but that seems to be unavailable to us. -->
                    <include>**/*Java8*.java</include>
                    <include>**/game/**/*.java</include>
                  </includes>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>2.12</version>
        <dependencies>
          <dependency>
            <groupId>com.puppycrawl.tools</groupId>
            <artifactId>checkstyle</artifactId>
            <version>6.6</version>
          </dependency>
        </dependencies>
        <configuration>
          <configLocation>../checkstyle.xml</configLocation>
          <consoleOutput>true</consoleOutput>
          <failOnViolation>true</failOnViolation>
          <includeTestSourceDirectory>true</includeTestSourceDirectory>
          <includeResources>false</includeResources>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- Source plugin for generating source and test-source JARs. -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>2.4</version>
        <executions>
          <execution>
            <id>attach-sources</id>
            <phase>compile</phase>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
          <execution>
            <id>attach-test-sources</id>
            <phase>test-compile</phase>
            <goals>
              <goal>test-jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <configuration>
          <windowtitle>Google Cloud Dataflow Examples</windowtitle>
          <doctitle>Google Cloud Dataflow Examples</doctitle>

          <subpackages>com.google.cloud.dataflow.examples</subpackages>
          <additionalparam>-exclude com.google.cloud.dataflow.sdk.runners.worker:com.google.cloud.dataflow.sdk.runners.dataflow:com.google.cloud.dataflow.sdk.util ${dataflow.javadoc_opts}</additionalparam>
          <use>false</use>
          <quiet>true</quiet>
          <bottom><![CDATA[<br>]]></bottom>

          <offlineLinks>
            <!-- The Dataflow SDK docs -->
            <offlineLink>
              <url>https://cloud.google.com/dataflow/java-sdk/JavaDoc/</url>
              <location>${basedir}/../javadoc/dataflow-sdk-docs</location>
            </offlineLink>
            <!-- Other dependencies -->
            <offlineLink>
              <url>https://developers.google.com/api-client-library/java/google-api-java-client/reference/1.20.0/</url>
              <location>${basedir}/../javadoc/apiclient-docs</location>
            </offlineLink>
            <offlineLink>
              <url>http://avro.apache.org/docs/1.7.7/api/java/</url>
              <location>${basedir}/../javadoc/avro-docs</location>
            </offlineLink>
            <offlineLink>
              <url>https://developers.google.com/resources/api-libraries/documentation/bigquery/v2/java/latest/</url>
              <location>${basedir}/../javadoc/bq-docs</location>
            </offlineLink>
            <offlineLink>
              <url>https://cloud.google.com/datastore/docs/apis/javadoc/</url>
              <location>${basedir}/../javadoc/datastore-docs</location>
            </offlineLink>
            <offlineLink>
              <url>http://docs.guava-libraries.googlecode.com/git-history/release18/javadoc/</url>
              <location>${basedir}/../javadoc/guava-docs</location>
            </offlineLink>
            <offlineLink>
              <url>http://fasterxml.github.io/jackson-annotations/javadoc/2.7/</url>
              <location>${basedir}/../javadoc/jackson-annotations-docs</location>
            </offlineLink>
            <offlineLink>
              <url>http://fasterxml.github.io/jackson-databind/javadoc/2.7/</url>
              <location>${basedir}/../javadoc/jackson-databind-docs</location>
            </offlineLink>
            <offlineLink>
              <url>http://www.joda.org/joda-time/apidocs</url>
              <location>${basedir}/../javadoc/joda-docs</location>
            </offlineLink>
            <offlineLink>
              <url>https://developers.google.com/api-client-library/java/google-oauth-java-client/reference/1.20.0/</url>
              <location>${basedir}/../javadoc/oauth-docs</location>
            </offlineLink>
          </offlineLinks>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>jar</goal>
            </goals>
            <phase>package</phase>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>2.4.1</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <finalName>${project.artifactId}-bundled-${project.version}</finalName>
              <artifactSet>
                <includes>
                  <include>*:*</include>
                </includes>
              </artifactSet>
              <filters>
                <filter>
                  <artifact>*:*</artifact>
                  <excludes>
                    <exclude>META-INF/*.SF</exclude>
                    <exclude>META-INF/*.DSA</exclude>
                    <exclude>META-INF/*.RSA</exclude>
                  </excludes>
                </filter>
              </filters>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <execution>
            <id>default-jar</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
          <execution>
            <id>default-test-jar</id>
            <goals>
              <goal>test-jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- Coverage analysis for unit tests. -->
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>com.google.cloud.dataflow</groupId>
      <artifactId>google-cloud-dataflow-java-sdk-all</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>com.google.api-client</groupId>
      <artifactId>google-api-client</artifactId>
      <version>${google-clients.version}</version>
      <exclusions>
        <!-- Exclude an old version of guava that is being pulled
             in by a transitive dependency of google-api-client -->
        <exclusion>
          <groupId>com.google.guava</groupId>
          <artifactId>guava-jdk5</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>com.google.apis</groupId>
      <artifactId>google-api-services-dataflow</artifactId>
      <version>${dataflow.version}</version>
      <exclusions>
        <!-- Exclude an old version of guava that is being pulled
             in by a transitive dependency of google-api-client -->
        <exclusion>
          <groupId>com.google.guava</groupId>
          <artifactId>guava-jdk5</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>com.google.apis</groupId>
      <artifactId>google-api-services-bigquery</artifactId>
      <version>${bigquery.version}</version>
      <exclusions>
        <!-- Exclude an old version of guava that is being pulled
             in by a transitive dependency of google-api-client -->
        <exclusion>
          <groupId>com.google.guava</groupId>
          <artifactId>guava-jdk5</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>com.google.http-client</groupId>
      <artifactId>google-http-client</artifactId>
      <version>${google-clients.version}</version>
      <exclusions>
        <!-- Exclude an old version of guava that is being pulled
             in by a transitive dependency of google-api-client -->
        <exclusion>
          <groupId>com.google.guava</groupId>
          <artifactId>guava-jdk5</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.apache.avro</groupId>
      <artifactId>avro</artifactId>
      <version>${avro.version}</version>
    </dependency>

    <dependency>
      <groupId>com.google.apis</groupId>
      <artifactId>google-api-services-datastore-protobuf</artifactId>
      <version>${datastore.version}</version>
      <exclusions>
        <!-- Exclude an old version of guava that is being pulled
             in by a transitive dependency of google-api-client -->
        <exclusion>
          <groupId>com.google.guava</groupId>
          <artifactId>guava-jdk5</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>com.google.apis</groupId>
      <artifactId>google-api-services-pubsub</artifactId>
      <version>${pubsub.version}</version>
      <exclusions>
        <!-- Exclude an old version of guava that is being pulled
             in by a transitive dependency of google-api-client -->
        <exclusion>
          <groupId>com.google.guava</groupId>
          <artifactId>guava-jdk5</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>com.google.cloud.datastore</groupId>
      <artifactId>datastore-v1-proto-client</artifactId>
      <version>${datastore.client.version}</version>
    </dependency>

    <dependency>
      <groupId>com.google.cloud.datastore</groupId>
      <artifactId>datastore-v1-protos</artifactId>
      <version>${datastore.proto.version}</version>
    </dependency>

    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>${guava.version}</version>
    </dependency>

    <dependency>
      <groupId>com.google.code.findbugs</groupId>
      <artifactId>jsr305</artifactId>
      <version>${jsr305.version}</version>
    </dependency>

    <dependency>
      <groupId>joda-time</groupId>
      <artifactId>joda-time</artifactId>
      <version>${joda.version}</version>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${slf4j.version}</version>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-jdk14</artifactId>
      <version>${slf4j.version}</version>
      <scope>runtime</scope>
    </dependency>

    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>3.1.0</version>
    </dependency>

    <!-- Hamcrest and JUnit are required dependencies of DataflowAssert,
         which is used in the main code of DebuggingWordCount example. -->

    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-all</artifactId>
      <version>${hamcrest.version}</version>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit.version}</version>
    </dependency>

    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-all</artifactId>
      <version>1.10.19</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>
