win10上编译flink1.10.0以运行在cdh6.3.0环境中

背景:虽然之前在win10上成功编译了flink-1.9.2以运行在cdh6.3.0环境中:

参考一:从源码编译Apache Flink快速部署和测试(包含指定Hadoop及Cloudera Hadoop、Blink)

参考二:flink 1.9 编译

但为了体验在1.9.x的基础上修复了的基于 Flink SQL 构建流式应用,现进行“win10上编译flink1.10.0以运行在cdh6.3.0环境中”。

首先,在https://github.com/apache/flink/releases处点击下载flink-release-1.10.0.tar包,虽然idea自带了maven3.3.9(位置:D:\Application\Java\IDEA2018.1\plugins\maven\lib\maven3\conf\settings.xml)但为了避免maven编译出现意外,于是毅然决然地在win10上自行安装了apache-maven-3.5.4并配置阿里源

虽然阿里源https://maven.aliyun.com/mvn/view可以看到网友普遍使用的下面的库:
    
      alimaven
      central
      aliyun maven
      https://maven.aliyun.com/repository/central
    
但我使用的下面库:
	
         nexus-aliyun
         central
         Nexus aliyun
         http://maven.aliyun.com/nexus/content/groups/public
	
   
	
      nexus-aliyun-apache
      central
      Nexus aliyun apache
      http://maven.aliyun.com/nexus/content/repositories/apache-snapshots/
	
 
	
      nexus-aliyun
      *,!jeecg,!jeecg-snapshots,!mapr-releases
      Nexus aliyun
      http://maven.aliyun.com/nexus/content/groups/public
	
 
	
      mapr-public
      mapr-releases
      mapr-releases
      https://maven.aliyun.com/repository/mapr-public
	

若使用之前编译flink1.9.x的编译命令却报错:

mvn -T4C clean install -DskipTests -Pvendor-repos -Dhadoop.version=3.0.0-cdh6.3.0 -Dflink.shaded.version=7.0 -Dscala-2.11 -Drat.skip=true(避免docs问题,见文末的“补充”说明)

发现报错信息显示:

Failure to find org.apache.flink:flink-shaded-jackson:jar:2.10.1-7.0 in https://repository.cloudera.com/artifactory/cloudera-repos was cached in the local repository

于是尝试使用最原始的编译命令报错:flink-hadoop-fs模块找不到flink-shaded-hadoop-2:jar:3.0.0-cdh6.3.0

mvn -T4C clean install -DskipTests -Pvendor-repos -Dhadoop.version=3.0.0-cdh6.3.0  -Dscala-2.11 -Drat.skip=true

win10上编译flink1.10.0以运行在cdh6.3.0环境中_第1张图片

经查mvnrepository仓库,从此链接处可以发现编译flink-1.10.x需要flink-shaded-10.0或9.0,而不是编译flink-1.9.x时需要的flink-shaded-8.0或7.0。而我并未找到flink官方编译对此的描述:

win10上编译flink1.10.0以运行在cdh6.3.0环境中_第2张图片

于是下载flink-shaded-release-10.0.tar并成功编译:

 mvn clean install -DskipTests -Drat.skip=true -Pvendor-repos -Dhadoop.version=3.0.0-cdh6.3.0

win10上编译flink1.10.0以运行在cdh6.3.0环境中_第3张图片

于是,win10上本地maven仓库中就有了flink-1.10.0所需要的flink-shaded的依赖项,如下图所示:

win10上编译flink1.10.0以运行在cdh6.3.0环境中_第4张图片

然后,再编译flink-1.10.0报错:flink-yarn和flink-yarn-tests两个模块的测试类均报错但报错并不都是newInstance方法中参数列表问题。

解决方案为在两模块pom.xml文件中添加:

			
				org.apache.maven.plugins
				maven-compiler-plugin
				3.8.0
				
					${java.version}
					${java.version}
					
					true
					
					false
					
						
						-Xpkginfo:always
					
				
			

即如下图所示:win10上编译flink1.10.0以运行在cdh6.3.0环境中_第5张图片

最后依然使用上面的编译命令成功编译flink-1.10.0源码至hadoop3.0.0-cdh6.3.0,如下图:

win10上编译flink1.10.0以运行在cdh6.3.0环境中_第6张图片

补充:文首所提到的编译命令中“避免docs问题”在之前编译flink-1.9.0时的问题描述如下:

若编译命令中不加-Drat.skip=true参数,即使注释掉报错的flink-docs子模块依然报错相同,如下图所示:

win10上编译flink1.10.0以运行在cdh6.3.0环境中_第7张图片

经查“参考二”文中,发现若不注释掉pom中任何一个模块,可通过编译命令中添加“-Drat.skip=true”避免docs报错问题。但“参考二”的评论区中,我所提到的flink-1.9.0编译时1/3日志处比较隐蔽的HUSKY SKIP INSTALL报错问题在win10上无法解决,可能需要linux环境下编译才能避免。win10上编译flink1.10.0以运行在cdh6.3.0环境中_第8张图片

你可能感兴趣的:(win10上编译flink1.10.0以运行在cdh6.3.0环境中)