如何在Google云数据流管道项目​​pom中使用beam-sdks-java-core-2.2.0.jar?

How to use beam-sdks-java-core-2.2.0.jar in Google Cloud dataflow pipeline project pom?

我最近使用 Google Java eclipse 插件建立了一个 Google 云数据流管道项目​​。而pom中默认的SKD版本是2.1.0。

<dependencies>
<dependency>
  <groupId>com.google.cloud.dataflow</groupId>
  <artifactId>google-cloud-dataflow-java-sdk-all</artifactId>
  <version>2.1.0</version>
</dependency>
... ...

并且代码可以部署,但是在向大查询中插入数据时出现NullPointerException异常。然后找到下面的文章,说这个问题在2.2.0版本已经修复了,https://issues.apache.org/jira/browse/BEAM-2834.

但我不知道该怎么做。我将 pom 版本从 2.1.0 更改为 2.2.0,所有依赖项都消失了,错误是 Missing artifact com.google.cloud.dataflow:google-cloud-dataflow-java-sdk-all:jar:2.2.0 并且 google-cloud-dataflow-java-sdk-all-2.1.0.jarbeam-sdks-java-core-2.1.0.jar 的版本相同。我不能只将 beam-sdks-java-core-2.1.0.jar 版本更改为 2.2.0

如果有人能给我一个关于如何更新 jar 版本或如何修复 NullPointerException 异常的示例,那将对我有很大帮助。

非常感谢。

=============================================

这是我的pom

<?xml version="1.0" encoding="UTF-8"?>
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ~ Copyright (C) 2017 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>

  <groupId>com.company.product</groupId>
  <artifactId>my-product</artifactId>
  <version>0.0.1-SNAPSHOT</version>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <repositories>
    <repository>
      <id>ossrh.snapshots</id>
      <name>Sonatype OSS Repository Hosting</name>
      <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

  <build>
   <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.6.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
    </plugins>

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>exec-maven-plugin</artifactId>
          <version>1.5.0</version>
          <configuration>
            <cleanupDaemonThreads>false</cleanupDaemonThreads>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <dependencies>
    <dependency>
      <groupId>com.google.cloud.dataflow</groupId>
      <artifactId>google-cloud-dataflow-java-sdk-all</artifactId>
      <version>2.1.0</version>
    </dependency>

    <!-- slf4j API frontend binding with JUL backend -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>1.7.14</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-jdk14</artifactId>
      <version>1.7.14</version>
    </dependency>
  </dependencies>
</project>

2.2.0 尚未从 Maven 获得,即 Google 尚未从 head/master 中删除并创建新的 2.2.0 构建。据我所知,目前正在进行中。

https://github.com/GoogleCloudPlatform/DataflowJavaSDK/releases https://mvnrepository.com/artifact/com.google.cloud.dataflow/google-cloud-dataflow-java-sdk-all

如果您愿意,可以下载最新版本并 build/use 自己 - 如果您等不及 2.2.0 版本。