我从github git clone flink代码,并用Intellij Idea打开它,我没有在IJ或代码中做任何配置(我已经安装了IJ scala插件并安装了scala sdk),我直接去运行以下两个Intellij Idea中的示例
我能够成功运行批处理模式字数计数示例(代码是类org.apache.flink.examples.scala.wordcount.WordCount in flink-examples-batch_2.11
模块)。
但是当我尝试运行流式字数统计示例(代码是类org.apache.flink.streaming.scala.examples.wordcount.WordCount in flink-examples-streaming_2.11
模块)时,我收到了很多编译错误:
Error:(30, 30) object streaming is not a member of package org.apache.flink.test
import org.apache.flink.test.streaming.runtime.util.TestListResultSink
Error:(46, 36) not found: type TestListResultSink
val sideOutputResultSink = new TestListResultSink[String]
Error:(47, 26) not found: type TestListResultSink
val resultSink = new TestListResultSink[Int]
Error:(82, 36) not found: type TestListResultSink
val sideOutputResultSink = new TestListResultSink[String]
Error:(83, 26) not found: type TestListResultSink
val resultSink = new TestListResultSink[Int]
Error:(119, 36) not found: type TestListResultSink
val sideOutputResultSink = new TestListResultSink[String]
Error:(120, 26) not found: type TestListResultSink
val resultSink = new TestListResultSink[Int]
Error:(152, 26) not found: type TestListResultSink
val resultSink = new TestListResultSink[String]
Error:(153, 30) not found: type TestListResultSink
val lateResultSink = new TestListResultSink[(String, Int)]
Error:(196, 26) not found: type TestListResultSink
val resultSink = new TestListResultSink[String]
Error:(197, 30) not found: type TestListResultSink
val lateResultSink = new TestListResultSink[(String, Int)]
Error:(242, 26) not found: type TestListResultSink
val resultSink = new TestListResultSink[String]
Error:(243, 36) not found: type TestListResultSink
val sideOutputResultSink = new TestListResultSink[String]
Error:(289, 26) not found: type TestListResultSink
val resultSink = new TestListResultSink[String]
Error:(290, 36) not found: type TestListResultSink
val sideOutputResultSink = new TestListResultSink[String]
如果我在GitHub.com上搜索TestListResultSink
,我会发现它是here。这表明我在flink-tests
模块中。你有没有在IntelliJ设置中包含它?
我最终在IntelliJ中运行got org.apache.flink.examples.scala.wordcount.WordCount
,但这并不容易。我尝试了很多东西,但我认为这是导致成功的道路:
mvn clean package -DskipTests
在命令行上构建整个项目org.apache.flink.examples.scala.wordcount.WordCount
和org.apache.flink.streaming.scala.examples.wordcount.WordCount
FWIW,Flink二进制版本附带了一些示例的jar文件,这些示例可以针对集群运行而无需编译任何内容。这是一种更简单的方法来运行。详情是here。
尝试构建您的项目,然后运行wordcount示例!
mvn clean package -DskipTests