无法在flink中运行wordcount示例

thtygnil  于 2021-06-21  发布在  Flink
关注(0)|答案(2)|浏览(473)

在导入flink-release-1.4.2的pom之后,我尝试运行wordcount示例,但是我无法构建它,因为scala有很多错误。

Information:19-2-20 上午2:45 - Compilation completed with 53 errors and 0 warnings in 2s 439ms
/media/maple/新加卷/download/Notes/flink-release-1.4.2/flink-examples/flink-examples-batch/src/main/scala/org/apache/flink/examples/scala/clustering/KMeans.scala
Error:(81, 14) not found: type ExecutionEnvironment
    val env: ExecutionEnvironment = ExecutionEnvironment.getExecutionEnvironment
Error:(81, 37) not found: value ExecutionEnvironment
    val env: ExecutionEnvironment = ExecutionEnvironment.getExecutionEnvironment
Error:(85, 17) not found: type DataSet
    val points: DataSet[Point] = getPointDataSet(params, env)
Error:(131, 74) not found: type DataSet
  def getPointDataSet(params: ParameterTool, env: ExecutionEnvironment): DataSet[Point] = {
Error:(131, 51) not found: type ExecutionEnvironment
  def getPointDataSet(params: ParameterTool, env: ExecutionEnvironment): DataSet[Point] = {
Error:(86, 20) not found: type DataSet
    val centroids: DataSet[Centroid] = getCentroidDataSet(params, env)

怎么了。当我只导入flink示例的pom时,wordcount程序可以正常运行。例如:

我试过重新导入maven,使缓存失效,并安装scala插件。

yhxst69z

yhxst69z1#

使用intellij,您将需要jetbrains scala插件,并且需要打开project structure对话框并在global libraries部分添加scala sdk。

ncecgwcz

ncecgwcz2#

问题解决了。我跑了 mvn clean package -DskipTests 并成功重建。

相关问题