Window环境下编译Flink1.10源码

基本环境

  • 至少JDK 8
  • Maven 3
  • Flink官 推荐工具使用 IDEA(下面内容均基于IDEA)
  • Flink源码拉取

    //使用git从github拉取https://github.com/apache/flink/

    由于从GitHub拉取比较慢,解决的方式有多种。这里列举一种借助gitee的方式:

    1、登录gitee — 创建仓库 — 导入已有仓库,耐心等待一段时间。

    2、将代码从gittee clone到本地。

    下载安装 Scala 插件

    因Flink具有用scala编写的API,因需要配置Scala插件及Scala SDK。

    配置Scala IDEA插件:File — Settings — Plugins — Maketplace — 搜索Scala — install

    下载并配置Scala SDK

    https://www.scala-lang.org/download/     //从官 下载scala的SDK

    配置Scala SDK:File — Project Structure — Platform Settings — Global Libraries — +号 — 选择Scala SDK

    这里选择Brown–指定刚下好Scala SDK 目录(解压)

    执行编译命令

    mvn clean install -DskipTests -Drat.skip=true  

    可能会遇到的问题及解决方案

    问题1:由于flink-runtime-web模块引入了frontend-maven-plugin依赖,并安装了node和部分依赖组件,会因 络原因导致 [ERROR] Failed to execute goal
    com.github.eirslett:frontend-maven-plugin:1.6:install-node-and-npm (install node and npm)

    解决方式:

    //修改 flink-runtime-web 的 pom,xml 文件镜像为淘宝镜像<nodeDownloadRoot>http://npm.taobao.org/mirrors/node/</nodeDownloadRoot><npmDownloadRoot>http://npm.taobao.org/mirrors/npm/</npmDownloadRoot>

    问题2:Could not resolve dependencies for project
    org.apache.flink:flink-avro-confluent-registry:jar:1.6.2:

    解决方式:

    //1、下载kafka-schema-registry-client-4.1.0.jar http://packages.confluent.io/maven/io/confluent/kafka-schema-registry-client/4.1.0/kafka-schema-registry-client-4.1.0.jar //2、手动安装mvn install:install-file -DgroupId=io.confluent -DartifactId=kafka-schema-registry-client -Dversion=4.1.0 -Dpackaging=jar  -Dfile=你所存放的目录/kafka-schema-registry-client-4.1.0.jar//3、继续编译mvn clean install -DskipTests -Drat.skip=true -rf :flink-avro-confluent-registry

    编译完成

    声明:本站部分文章内容及图片转载于互联 、内容不代表本站观点,如有内容涉及侵权,请您立即联系本站处理,非常感谢!

    (0)
    上一篇 2020年4月1日
    下一篇 2020年4月1日

    相关推荐