0


flink1.18源码本地调试环境

01 源码本地调试环境搭建

1. 从github拉取源码创建本地项⽬


https://github.com/apache/flink.git

可以拉取github上官⽅代码

https://github.com/apache/flink.git

GitHub - apache/flink: Apache Flink

2. 配置编译环境

ctrl+alt+shift+s (或菜单)打开项⽬结构,确保jdk版本为1.8,scala版本最好为2.12.73. 源码编译

跳过调试

4、准备运⾏环境

• 在项⽬根⽬录下,创建如下两个⽂件夹:找到如下⼦模块,并展开如图

• 将上图中conf下的⽂件,拷⻉到项⽬根⽬录下创建的conf下

• 将上图中的lib下的jar包,拷⻉到项⽬根⽬录下创建的distlib下

5、编译中遇到的问题

5.1flink 1.18 源码编译 shader 19

编译 Flink Shaded

  • 进入 Flink 源码目录,并切换到相应的 Shaded 版本分支,例如 flink-shaded-193。
  • 执行 Maven 命令来编译 Flink Shaded 19 版本: mvn clean package -DskipTests 这将编译 Flink Shaded 19 并生成相应的构建产物

5.2 Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.1.2:check (validate) on project flink-runtime: You have 3 Checkstyle violations.

  1. 运行 Checkstyle 检查:- 在修正了代码风格问题后,你可以单独运行 Checkstyle 插件来检查问题是否已经解决。使用以下 Maven 命令: mvn checkstyle:check- 如果之前没有配置 Checkstyle,或者你想使用不同的配置文件,可以通过 -DconfigLocation 参数指定 Checkstyle 配置文件: mvn checkstyle:check -DconfigLocation=checkstyle.xml

  2. 整合到构建流程

一旦所有的 Checkstyle 违规问题都被解决,并且本地构建成功,你可以再次尝试完整的 Maven 构建流程:

复制

mvn clean package -DskipTests

5.3[ERROR] Failed to execute goal on project flink-avro-confluent-registry: Could not resolve dependencies for project org.apache.flink:flink-avro-confluent-registry:jar:1.18-SNAPSHOT: Failed to collect dependencies at io.confluent :kafka-schema-registry-client:jar:7.2.2: Failed to read artifact descriptor for io.confluent:kafka-schema-registry-client:jar:7.2.2: The following artifacts could not be resolved: io.confluent:kafka-schema-registry-parent:pom:7.2.2 (present, but unavailable): Could not find artifact io.confluent:kafka-schema-registry-parent:pom:7.2.2 in nexus-aliyun

先去https://mvnrepository.com去搜索下载。
发现https://maven.ceon.pl/artifactory/repo/io/confluent/kafka-schema-registry-client/7.2.2/ 大 小有问题。爆了以下错误

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project flink-avro-confluent-registry: Compilation failure: Compilation failure:
[ERROR] error reading /Users/AllenBai/.m2/repository/io/confluent/kafka-schema-registry-client/3.3.1/kafka-schema-registry-client-7.2.2.jar; error in opening zip file
[ERROR] error reading /Users/AllenBai/.m2/repository/io/confluent/kafka-schema-registry-client/7.2.2/kafka-schema-registry-client-7.2.2.jar; error in opening zip file

wget http://packages.confluent.io/maven/io/confluent/kafka-schema-registry-client/7.2.2/kafka-schema-registry-client-7.2.2.jar

安装
mvn install:install-file -DgroupId='io.confluent' -DartifactId='kafka-schema-registry-client' -Dversion='7.2.2' -Dpackaging='jar' -Dfile='D:/Tools/jar/kafka-schema-registry-client-7.2.2.jar' '-DskipTests' '-Dmaven.javadoc.skip=true' '-Dmaven.compile.fork=true'

编译成功


本文转载自: https://blog.csdn.net/ycjunhua/article/details/137360524
版权归原作者 ycjunhua 所有, 如有侵权,请联系我们删除。

“flink1.18源码本地调试环境”的评论:

还没有评论