1. 从官网下载flink源码

  1. https://mirror.bit.edu.cn/apache/flink/flink-1.10.0/flink-1.10.0-src.tgz

2. 解压

  1. tar -zxvf flink-1.10.0-src.tgz

3.从idea中导入源码

image.png

4.到flink根目录下执行一下指令

  1. $ mvn archetype:generate

5. 当出现以后提示

  1. Define value for property 'groupId': org.apache.flink
  2. Define value for property 'artifactId': flink-quickstart-java
  3. Define value for property 'version' 1.0-SNAPSHOT: : 1.8.0
  4. Define value for property 'package' org.apache.flink: : com.panda
  5. Confirm properties configuration:
  6. groupId: org.apache.flink
  7. artifactId: flink-quickstart-java
  8. version: 1.8.0
  9. package: com.panda

出现一下界面,说明编译成功
image.png

6 编译中遇到的问题

  1. Maven Error: Too many files with unapproved license
  1. mvn命令中加上-Drat.skip=true进行编译即可
  1. Could not resolve dependencies for project org.apache.flink:flink-oss-fs-hadoop:jar:1.10.0:

mvn clean install -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Drat.skip=true

maven编译问题
问题:Failed to execute goal com.diffplug.spotless:spotless-maven-plugin:2.4.2:check (spotless-check) on project flinkx-core: The following files had format violations:
解决方法:编译之前先执行:mvn spotless:apply
[

](https://blog.csdn.net/weixin_42144283/article/details/122067295)
编译指令:
mvn clean install -DskipTests -Dfast