赞
踩
北京时间:2020年04月21日12:16:00
本人环境:
系统:macOS 10.14.6、Maven版本:3.5.4、JDK版本:1.8.0_201
IDE版本:IntelliJ IDEA 2020.1
Hive版本:3.1.1(当前最新的HIve分支4.0我也编译了)
可以通过git clone xxxxxxx
直接拉取分支
例如:git clone https://github.com/apache/hive.git
直接下载源码
例如:https://codeload.github.com/apache/hive/tar.gz/rel/release-3.1.1
进入源码的项目目录,例如:cd ~/code/java/hive-rel-release-3.1.1
需要先执行:export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home
(这是似乎是因为开发人员编译的环境变量会写脚本中,但是我们这里没有,这里好像也是Maven的一个bug)
执行编译命令:mvn clean package -DskipTests -Phadoop-2 -Pdist
当你看到BUILD SUCCESS
时说明编译成功
[INFO] Hive HCatalog Webhcat Java Client .................. SUCCESS [ 1.932 s] [INFO] Hive HCatalog Webhcat .............................. SUCCESS [ 6.526 s] [INFO] Hive HCatalog Streaming ............................ SUCCESS [ 55.170 s] [INFO] Hive HPL/SQL ....................................... SUCCESS [04:46 min] [INFO] Hive Streaming ..................................... SUCCESS [ 1.450 s] [INFO] Hive Llap External Client .......................... SUCCESS [ 1.428 s] [INFO] Hive Shims Aggregator .............................. SUCCESS [ 0.047 s] [INFO] Hive Kryo Registrator .............................. SUCCESS [ 8.624 s] [INFO] Hive TestUtils ..................................... SUCCESS [ 0.085 s] [INFO] Hive Packaging 3.1.1 ............................... SUCCESS [ 51.884 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 09:40 min [INFO] Finished at: 2020-04-21T11:27:26+08:00 [INFO] ------------------------------------------------------------------------ [WARNING] The requested profile "hadoop-2" could not be activated because it does not exist.
注意:
在编译Hive 3.1.1时mvn报错:提示找不到javadoc
这个工具
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.4:javadoc (resourcesdoc.xml) on project hive-webhcat: An error has occurred in JavaDocs report generation:Unable to find javadoc command: The environment variable JAVA_HOME is not correctly set. -> [Help 1]
[ERROR]
[ERROR] To 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]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :hive-webhcat
在查阅后发现这是可能是(众说纷纭):
解决方法:
在项目目录最外层的pom.xml
的<properties>
标签中加入<javadocExecutable>${java.home}/../bin/javadoc</javadocExecutable>
<properties>
<javadocExecutable>${java.home}/../bin/javadoc</javadocExecutable>
......(其他的省略)
</properties>
说明:就是直接告诉maven-javadoc-plugin插件javadoc的具体位置:/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/bin/javadoc
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。