0.编译flink1.9.0源码 报flink-fs-hadoop-shaded找不到

2,067 阅读3分钟
git clone git@github.com:apache/flink.git

然后你可以切换到项目的不同分支,执行下面命令将代码切换到 release-1.9 分支:

git checkout release-1.9
mvn clean install -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true
  • -Dmaven.test.skip:跳过测试代码
  • -Dmaven.javadoc.skip:跳过 javadoc 检查
  • -Dcheckstyle.skip:跳过代码风格检查

maven 编译的时候跳过这些检查,这样可以减少很多时间,还可能会减少错误的发生。

注意:你的 maven 的 settings.xml 文件的 mirror 添加下面这个(这样才能下载到某些下载不了的依赖)。

<mirror>
  <id>nexus-aliyun</id>
  <mirrorOf>*,!jeecg,!jeecg-snapshots,!mapr-releases</mirrorOf>
  <name>Nexus aliyun</name>
  <url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>

<mirror>
  <id>mapr-public</id>
  <mirrorOf>mapr-releases</mirrorOf>
  <name>mapr-releases</name>
  <url>https://maven.aliyun.com/repository/mapr-public</url>
</mirror>

编译报错

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:12 min
[INFO] Finished at: 2020-02-22T09:00:29+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project flink-s3-fs-hadoop: Could not resolve dependencies for project org.apache.flink:flink-s3-fs-hadoop:jar:1.9-SNAPSHOT: Could not find artifact org.apache.flink:flink-fs-hadoop-shaded:jar:tests:1.9-SNAPSHOT in nexus-aliyun (http://maven.aliyun.com/nexus/content/groups/public) -> [Help 1]
[ERROR
[ERRORTo see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR
[ERRORFor more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR
[ERRORAfter correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :flink-s3-fs-hadoop

解决方法

在网站 https://www.mvnjar.com/
搜索对应的jar包

在这里插入图片描述
在这里插入图片描述

下载后添加到本地

192:flink lijun$ mvn install:install-file -DgroupId=org.apache.flink -DartifactId=flink-fs-hadoop-shaded -Dversion=1.9-SNAPSHOT -Dpackaging=jar  -Dfile=/Users/lijun/Downloads/flink-s3-fs-hadoop-1.9.0.jar
[INFO] Scanning for projects...
[WARNING
[WARNINGSome problems were encountered while building the effective model for org.apache.flink:flink-scala_2.11:jar:1.9-SNAPSHOT
[WARNING'artifactId' contains an expression but should be a constant. @ org.apache.flink:flink-scala_${scala.binary.version}:[unknown-version], /Users/lijun/IT/workspace/workspace_idea/bigData/flink/flink-scala/pom.xml, line 31column 14
[WARNING'build.plugins.plugin.version' for org.codehaus.mojo:build-helper-maven-plugin is missing. @ org.apache.flink:flink-scala_${scala.binary.version}:[unknown-version], /Users/lijun/IT/workspace/workspace_idea/bigData/flink/flink-scala/pom.xml, line 215column 12
[WARNING
[WARNINGSome problems were encountered while building the effective model for org.apache.flink:flink-runtime_2.11:jar:1.9-SNAPSHOT
[WARNING'artifactId' contains an expression but should be a constant. @ org.apache.flink:flink-runtime_${scala.binary.version}:[unknown-version], /Users/lijun/IT/workspace/workspace_idea/bigData/flink/flink-runtime/pom.xml, line 32column 14
[WARNING'build.plugins.plugin.version' for org.codehaus.mojo:build-helper-maven-plugin is missing. @ org.apache.flink:flink-runtime_${scala.binary.version}:[unknown-version], /Users/lijun/IT/workspace/workspace_idea/bigData/flink/flink-runtime/pom.xml, line 424column 12
[WARNINGSome problems were encountered while building the effective model for org.apache.flink:flink-table-planner_2.11:jar:1.9-SNAPSHOT
[WARNING'artifactId' contains an expression but should be a constant. @ org.apache.flink:flink-table-planner_${scala.binary.version}:[unknown-version], /Users/lijun/IT/workspace/workspace_idea/bigData/flink/flink-table/flink-table-planner/pom.xml, line 30column 14
[WARNING

[WARNINGSome problems were encountered while building the effective model for or
[INFO] flink-plugins-test ................................. SKIPPED
[INFO] dummy-fs ........................................... SKIPPED
[INFO] another-dummy-fs ................................... SKIPPED
[INFO] flink-tpch-test .................................... SKIPPED
[INFO] flink-contrib ...................................... SKIPPED
[INFO] flink-connector-wikiedits .......................... SKIPPED
[INFO] flink-yarn-tests ................................... SKIPPED
[INFO] flink-fs-tests ..................................... SKIPPED
[INFO] flink-docs ......................................... SKIPPED
[INFO] flink-ml-parent .................................... SKIPPED
[INFO] flink-ml-api ....................................... SKIPPED
[INFO] flink-ml-lib 1.9-SNAPSHOT .......................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time3.672 s
[INFO] Finished at2020-02-22T09:11:41+08:00
[INFO] ------------------------------------------------------------------------
192:flink lijun$ 

问题解决