环境系列——window10环境下编译Flink源码编译
1. 环境
- window10 家庭版;
- JDK 1.8
- maven 3.2.5
- Flink源码
- IDEA以及安装scala插件
说明:Flink获取的方式可以参考阅读GitHub源码的正确打开方式,通过这种方式可以使用git切换版本以及查看提交记录,极大方便我们根据需要编译flink。
2. 编译
2.1 编译命令
mvn clean package -DskipTests -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Drat.skip=true
2.2 编译步骤
- 使用git切换Flink版本(这里以Flink1.9为例);
- 在CMD窗口中进入Flink的根目录,执行命令(如D:\Develop\gitRepository\flink);
3. 报错问题总结
3.1 获取不到插件类型
Failed to execute goal on project flink-connector-gcp-pubsub_2.11: Could not resolve dependencies for project org.apache.flink:flink-connector-gcp-pubsub_2.11:jar:1.9-SNAPSHOT: Could not find artifact io.grpc:grpc-core:jar:1.17.1 -> [Help 1]
解决方法:
在maven的setting.xml文件中添加阿里的库,若不行可以采取手动下载后,使用mvn install命令安装;
3.2 证书问题
Failed to execute goal org.apache.rat:apache-rat-plugin:0.12:check (default) on project flink-parent: Too many files with unapproved license: 3 See RAT report in: D:\Develop\gitRepository\flink\target\rat.txt -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.rat:apache-rat-plugin:0.12:check (default) on project flink-parent: Too many files with unapproved license: 3 See RAT report in: D:\Develop\gitRepository\flink\target\rat.txt
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
解决方案:在编译命令中加上-Drat.skip=true ,以提前避免证书校验(参见博客)。
3.3 无法下载
Installing node version v10.9.0
[INFO] Downloading https://nodejs.org/dist/v10.9.0/node-v10.9.0-win-x64.zip to D:\Develop\devConfig\maven-repository\com\github\eirslett\node\10.9.0\node-10.9.0-win-x64.zip
[INFO] No proxies configured
[INFO] No proxy was configured, downloading directly
通过尝试使用网上提供的方案pom文件中新增
思路:
1、 手动下载node-v10.9.0-win-x64.zip;
2、 放在指定目录中,重新执行就应该没有了。
3.4 其他问题
Browserslist: caniuse-lite is outdated. Please run next command npm update
另开cmd窗口,运行npm update caniuse-lite
可以有用的URL:
[1] http://packages.confluent.io/maven/io/confluent/kafka-schema-registry-client/