2

からApacheのビーム/ Googleクラウドデータフロージョブの実行:私は、次のコマンド文字列を使用してのIntelliJ IDEAから実行しているGoogleクラウドデータフローの仕事をしているのmaven-建て瓶

compile exec:java -Dexec.mainClass=com.mygroup.mainclass "-Dexec.args=--..." 

それはより細かい動作しますここでは、ビルド時に自動的に実行されるように、これをローカルサーバーに展開したいと考えています。 argsはパイプラインオプションを指定します。任意のビルドでこのパイプラインを使用して3つの異なるジョブを開始する必要があり、3回再コンパイルしなければならないのは無駄です。だから私は、次のようにjarファイルを生成するためにMVNパッケージを使用しています:

clean compile assembly:single 

私は-jar my_pipeline-1.0-SNAPSHOT-ジャーと-dependencies.jarのjava経由のパイプラインを実行すると、問題は、あります--argsプロジェクトのターゲットディレクトリに、私は例外を取得しています:

Exception in thread "main" java.lang.IllegalArgumentException: 
Unknown 'runner' specified 'DataflowRunner', supported pipeline runners [DirectRunner] 

ビームメーリングリストの投稿は、実行時にクラスパスを設定する-Pdataflowランナーを渡すことをお勧めしますが、私が発見していません私がちょうど瓶を呼んでいるなら、その仕事をする方法。私はコンパイルとパッケージステップ中にプロファイルを指定しようとしましたが、それは助けにはなりません。

ここは私のpom.xmlです。少し面倒かもしれません。私はこの仕事をしようとすることに散乱的なアプローチを試みてきましたが、まだ壁には何も固執していません。

<?xml version="1.0" encoding="UTF-8"?> 
<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.mygroup</groupId> 
    <artifactId>data_dump</artifactId> 
    <version>1.0-SNAPSHOT</version> 
    <packaging>jar</packaging> 
    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <maven.compiler.source>1.8</maven.compiler.source> 
     <maven.compiler.target>1.8</maven.compiler.target> 
     <slf4j.version>1.7.5</slf4j.version> 
     <junit.version>4.8.2</junit.version> 
     <hamcrest.version>1.3</hamcrest.version> 
     <mockito.version>1.10.19</mockito.version> 
     <bigquery.version>v2-rev312-1.22.0</bigquery.version> 
     <powermock.version>1.6.6</powermock.version> 
     <beam.version>2.0.0</beam.version> 
    </properties> 
    <build> 
     <plugins> 
      <plugin> 
       <artifactId>maven-assembly-plugin</artifactId> 
       <configuration> 
        <archive> 
         <manifest> 
          <mainClass>com.mygroup.mainclass</mainClass> 
          <addClasspath>true</addClasspath> 
         </manifest> 
        </archive> 
        <descriptorRefs> 
         <descriptorRef>jar-with-dependencies</descriptorRef> 
        </descriptorRefs> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>3.3</version> 
       <configuration> 
        <source>1.8</source> 
        <target>1.8</target> 
       </configuration> 
      </plugin> 
      <plugin> 
       <!-- Build an executable JAR --> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-jar-plugin</artifactId> 
       <version>3.0.2</version> 
       <configuration> 
        <archive> 
         <manifest> 
          <addClasspath>true</addClasspath> 
          <classpathPrefix>.</classpathPrefix> 
          <mainClass>com.mygroup.mainclass</mainClass> 
         </manifest> 
        </archive> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-shade-plugin</artifactId> 
       <version>2.4.3</version> 
       <executions> 
        <execution> 
         <phase>package</phase> 
         <goals> 
          <goal>shade</goal> 
         </goals> 
         <configuration> 
          <filters> 
           <filter> 
            <artifact>*:*</artifact> 
            <excludes> 
             <exclude>META-INF/**</exclude> 
            </excludes> 
           </filter> 
          </filters> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 
      <plugin> 
       <groupId>org.codehaus.mojo</groupId> 
       <artifactId>cobertura-maven-plugin</artifactId> 
       <configuration> 
        <aggregate>true</aggregate> 
       </configuration> 
       <executions> 
        <execution> 
         <goals> 
          <goal>clean</goal> 
         </goals> 
        </execution> 
       </executions> 
      </plugin> 
      <plugin> 
       <groupId>org.codehaus.mojo</groupId> 
       <artifactId>exec-maven-plugin</artifactId> 
       <executions> 
        <execution> 
         <goals> 
          <goal>java</goal> 
         </goals> 
        </execution> 
       </executions> 
       <configuration> 
        <executable>java</executable> 
        <arguments> 
        </arguments> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 

    <profiles> 
     <profile> 
      <id>direct-runner</id> 
      <activation> 
       <activeByDefault>true</activeByDefault> 
      </activation> 
      <!-- Makes the DirectRunner available when running a pipeline. --> 
      <dependencies> 
       <dependency> 
        <groupId>org.apache.beam</groupId> 
        <artifactId>beam-runners-direct-java</artifactId> 
        <version>${beam.version}</version> 
        <scope>runtime</scope> 
       </dependency> 
      </dependencies> 
     </profile> 
     <profile> 
      <id>dataflow-runner</id> 
      <activation> 
       <activeByDefault>true</activeByDefault> 
      </activation> 
      <dependencies> 
       <dependency> 
        <groupId>com.google.cloud.dataflow</groupId> 
        <artifactId>google-cloud-dataflow-java-sdk-all</artifactId> 
        <version>${beam.version}</version> 
       </dependency> 
      </dependencies> 
     </profile> 
     <profile> 
      <id>flink-runner</id> 
      <!-- Makes the FlinkRunner available when running a pipeline. --> 
      <dependencies> 
       <dependency> 
        <groupId>org.apache.beam</groupId> 
        <artifactId>beam-runners-flink_2.10</artifactId> 
        <version>${beam.version}</version> 
        <scope>runtime</scope> 
       </dependency> 
      </dependencies> 
      <build> 
       <plugins> 
        <plugin> 
         <groupId>org.apache.maven.plugins</groupId> 
         <artifactId>maven-shade-plugin</artifactId> 
        </plugin> 
       </plugins> 
      </build> 
     </profile> 
    </profiles> 

    <dependencies> 
     <dependency> 
      <groupId>org.apache.beam</groupId> 
      <artifactId>beam-sdks-java-core</artifactId> 
      <version>${beam.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>com.google.cloud</groupId> 
      <artifactId>google-cloud-bigquery</artifactId> 
      <version>0.18.0-beta</version> 
     </dependency> 
     <dependency> 
      <groupId>com.google.cloud</groupId> 
      <artifactId>google-cloud-storage</artifactId> 
      <version>1.0.0</version> 
     </dependency> 
     <dependency> 
      <groupId>com.google.cloud.dataflow</groupId> 
      <artifactId>google-cloud-dataflow-java-sdk-all</artifactId> 
      <version>${beam.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.beam</groupId> 
      <artifactId>beam-runners-direct-java</artifactId> 
      <version>${beam.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.beam</groupId> 
      <artifactId>beam-sdks-java-io-google-cloud-platform</artifactId> 
      <version>${beam.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.beam</groupId> 
      <artifactId>beam-runners-google-cloud-dataflow-java</artifactId> 
      <version>${beam.version}</version> 
      <scope>runtime</scope> 
     </dependency> 

     <!-- slf4j API frontend binding with JUL backend --> 
     <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> 
     </dependency> 
     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>RELEASE</version> 
     </dependency> 
     <dependency> 
      <groupId>org.hamcrest</groupId> 
      <artifactId>hamcrest-library</artifactId> 
      <version>1.3</version> 
     </dependency> 
     <dependency> 
      <groupId>com.microsoft.azure</groupId> 
      <artifactId>azure-storage</artifactId> 
      <version>5.0.0</version> 
     </dependency> 
     <dependency> 
      <groupId>com.esotericsoftware.yamlbeans</groupId> 
      <artifactId>yamlbeans</artifactId> 
      <version>1.08</version> 
     </dependency> 
     <dependency> 
      <groupId>commons-io</groupId> 
      <artifactId>commons-io</artifactId> 
      <version>2.5</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.commons</groupId> 
      <artifactId>commons-collections4</artifactId> 
      <version>4.1</version> 
     </dependency> 
     <dependency> 
      <groupId>org.powermock</groupId> 
      <artifactId>powermock-module-junit4</artifactId> 
      <version>${powermock.version}</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.powermock</groupId> 
      <artifactId>powermock-api-easymock</artifactId> 
      <version>${powermock.version}</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.easymock</groupId> 
      <artifactId>easymock</artifactId> 
      <version>3.4</version> 
     </dependency> 
    </dependencies> 
    <repositories> 
     <repository> 
      <id>apache-maven-repo</id> 
      <name>Apache Nightlies</name> 
      <url>https://repository.apache.org/content/repositories/snapshots/</url> 
      <releases> 
       <enabled>true</enabled> 
      </releases> 
      <snapshots> 
       <enabled>true</enabled> 
      </snapshots> 
     </repository> 
    </repositories> 
</project> 

答えて

2

これを解決しました。私のポンにはいくつかのことが間違っていました。

まず、依存関係の順序が間違っていました。私はbeam-runners-google-cloud-dataflow-java依存関係をリストの一番上に移動し、私が受け取っていたエラーは消え去った。

私はさらに別の例外が発生しました:パッケージの代わりに、アセンブリとthis questionの指示や建物に続いて

Caused by: java.lang.IllegalStateException: Unable to find registrar for gs. 

を、私は起動に私の仕事を得ることができました。すごい!

関連する問題