自定义CDH版本编译apache kylin

因kylin官网发布的2.6.0版本中cdh版本为5.7.0 ,而我们测试环境和生产环境都是cdh5.16.1,所以需要自己调整cdh版本自己编译。本文主要记录编译过程以及编译过程中遇到的报错,并记录一些编译技巧。

这里提供编译过程中需要的一些安装包,以及编译后的一个maven本地仓库

链接:https://pan.baidu.com/s/1Jv5nQNpsk3yplxekVemYvQ

提取码:zsr6

一、编译环境

Vmware 虚拟机 centos7.5

maven3.3.9

node-v12.16.3-linux-x64

bower

git

其中maven配置阿里云maven仓库

bower通过 npm install -g bower 来安装

二、开始编译

(2.1)解压源码

从https://archive.apache.org/dist/kylin/apache-kylin-2.6.0/ 上下载源码包 apache-kylin-2.6.0-source-release.zip

上传到服务器并解压

(2.2)修改pom文件

(2.2.1)修改父工程pom文件中的cdh版本

修改pom文件中cdh的版本,因源码中是cdh5.7.0版本的,而本次我们要编译的是cdh5.16.1版本

(2.2.2)修改父pom文件中跳过doclint编译

在pom文件中,properties标签中添加跳过doclint的配置: <additionalparam>-Xdoclint:none</additionalparam>

(2.3)正式开始编译

进入源码目录:cd /home/hadoop/sourcecode/apache-kylin-2.6.0

编译命令:build/script/package.sh -Dmaven.test.skip -Pcdh5.16

(2.4)编译过程中遇到的问题

编译过程中遇到几类问题:

第一类:pom文件中插件版本原因导致编译失败

第二类:一些jar包因网络原因下载不下来导致编译失败

第三类:服务器环境缺少相应的包导致编译失败

(2.4.1)第一类问题

在编译module engine-spark时,出现以下错误:

[ERROR] Failed to execute goal net.alchim31.maven:scala-maven-plugin:4.4.0:compile (scala-compile-first) on project kylin-engine-spark: Execution scala-compile-first of goal net.alchim31.maven:scala-maven-plugin:4.4.0:compile failed.: CompileFailed -> [Help 1]

原因:这个是 scala-maven-plugin 这个插件版本不对导致的。因pom文件中没有显式指定插件的版本,这里就显式指定一下,增加:<version>3.2.0</version>


(2.4.2)第二类问题

因网络原因下载不下来jar包,导致编译失败,这种问题只能手动将jar包下载下来后,安装到maven本地仓库

[ERROR] Failed to execute goal on project kylin: Could not resolve dependencies for project org.apache.kylin:kylin:pom:2.6.0: Failed to collect dependencies at org.apache.hadoop:hadoop-common:jar:2.6.0-cdh5.16.1: Failed to read artifact descriptor for org.apache.hadoop:hadoop-common:jar:2.6.0-cdh5.16.1: Could not transfer artifact org.apache.hadoop:hadoop-common:pom:2.6.0-cdh5.16.1 from/to cloudera (https://repository.cloudera.com/artifactory/cloudera-repos/): GET request of: org/apache/hadoop/hadoop-common/2.6.0-cdh5.16.1/hadoop-common-2.6.0-cdh5.16.1.pom from cloudera failed: Read timed out -> [Help 1]

原因:缺少jar包 org.apache.hadoop:hadoop-common:jar:2.6.0-cdh5.16.1

[ERROR] Failed to execute goal on project kylin-engine-spark: Could not resolve dependencies for project org.apache.kylin:kylin-engine-spark:jar:2.6.0: Failed to collect dependencies at org.apache.hbase:hbase-server:jar:1.2.0-cdh5.16.1: Failed to read artifact descriptor for org.apache.hbase:hbase-server:jar:1.2.0-cdh5.16.1: Could not transfer artifact org.apache.hbase:hbase-server:pom:1.2.0-cdh5.16.1 from/to cloudera (https://repository.cloudera.com/artifactory/cloudera-repos/): Connection reset -> [Help 1]

原因:缺少jar包 org.apache.hbase:hbase-server:jar:1.2.0-cdh5.16.1

[ERROR] Failed to execute goal on project kylin-server-base: Could not resolve dependencies for project org.apache.kylin:kylin-server-base:jar:2.6.0: Failed to collect dependencies at org.springframework.security.extensions:spring-security-saml2-core:jar:1.0.2.RELEASE -> org.opensaml:opensaml:jar:2.6.6: Failed to read artifact descriptor for org.opensaml:opensaml:jar:2.6.6: Could not transfer artifact org.opensaml:opensaml:pom:2.6.6 from/to spring-snapshots (http://repo.spring.io/libs-snapshot): Access denied to: http://repo.spring.io/libs-snapshot/org/opensaml/opensaml/2.6.6/opensaml-2.6.6.pom , ReasonPhrase:Forbidden. -> [Help 1]

原因:缺少jar包 org.opensaml:opensaml:jar:2.6.6

[ERROR] Failed to execute goal on project kylin-server-base: Could not resolve dependencies for project org.apache.kylin:kylin-server-base:jar:2.6.0: Failed to collect dependencies at org.springframework.security.extensions:spring-security-saml2-core:jar:1.0.2.RELEASE -> org.opensaml:opensaml:jar:2.6.6: Failed to read artifact descriptor for org.opensaml:opensaml:jar:2.6.6: Could not transfer artifact net.shibboleth:parent-v2:pom:4 from/to spring-snapshots (http://repo.spring.io/libs-snapshot): Access denied to: http://repo.spring.io/libs-snapshot/net/shibboleth/parent-v2/4/parent-v2-4.pom , ReasonPhrase:Forbidden. -> [Help 1]

原因:缺少父pom net.shibboleth:parent-v2:pom:4

[ERROR] Failed to execute goal on project kylin-server-base: Could not resolve dependencies for project org.apache.kylin:kylin-server-base:jar:2.6.0: Failed to collect dependencies at org.springframework.security.extensions:spring-security-saml2-core:jar:1.0.2.RELEASE -> org.opensaml:opensaml:jar:2.6.6 -> org.opensaml:openws:jar:1.5.6: Failed to read artifact descriptor for org.opensaml:openws:jar:1.5.6: Could not transfer artifact org.opensaml:openws:pom:1.5.6 from/to spring-snapshots (http://repo.spring.io/libs-snapshot): Access denied to: http://repo.spring.io/libs-snapshot/org/opensaml/openws/1.5.6/openws-1.5.6.pom , ReasonPhrase:Forbidden. -> [Help 1]

原因:缺少jar包 org.opensaml:openws:jar:1.5.6

[ERROR] Failed to execute goal on project kylin-server-base: Could not resolve dependencies for project org.apache.kylin:kylin-server-base:jar:2.6.0: Failed to collect dependencies at org.springframework.security.extensions:spring-security-saml2-core:jar:1.0.2.RELEASE -> org.opensaml:opensaml:jar:2.6.6 -> org.opensaml:openws:jar:1.5.6 -> org.opensaml:xmltooling:jar:1.4.6: Failed to read artifact descriptor for org.opensaml:xmltooling:jar:1.4.6: Could not transfer artifact org.opensaml:xmltooling:pom:1.4.6 from/to spring-snapshots (http://repo.spring.io/libs-snapshot): Access denied to: http://repo.spring.io/libs-snapshot/org/opensaml/xmltooling/1.4.6/xmltooling-1.4.6.pom , ReasonPhrase:Forbidden. -> [Help 1]

原因:缺少jar包 org.opensaml:xmltooling:jar:1.4.6

bower angular-underscore#~0.5.0 resolved https://github.com/floydsoft/angular-underscore.git#0.5.0

bower sweetalert#>=0.3.0                    ECONNREFUSED Request to https://registry.bower.io/packages/sweetalert failed: connect ECONNREFUSED 104.31.72.212:443

原因:ping 104.31.72.212 能ping通           telnet 104.31.72.212 443 也能连上    估计是网络问题  重试即可

(2.4.3)第三类问题

服务器环境缺少相应的包导致编译失败

PhantomJS not found on PATH

Downloading https://github.com/Medium/phantomjs/releases/download/v1.9.19/phantomjs-1.9.8-linux-x86_64.tar.bz2

Saving to /tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2

Receiving...

  [========================================] 100%

Received 12854K total.

Extracting tar contents (via spawned process)

Error extracting archive

Phantom installation failed Error: Command failed: tar jxf /tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2

tar (child): bzip2:无法 exec: 没有那个文件或目录

tar (child): Error is not recoverable: exiting now

tar: Child returned status 2

tar: Error is not recoverable: exiting now

    at ChildProcess.exithandler (child_process.js:303:12)

    at ChildProcess.emit (events.js:310:20)

    at maybeClose (internal/child_process.js:1021:16)

    at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) {

  killed: false,

  code: 2,

  signal: null,

  cmd: 'tar jxf /tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2'

} Error: Command failed: tar jxf /tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2

tar (child): bzip2:无法 exec: 没有那个文件或目录

tar (child): Error is not recoverable: exiting now

tar: Child returned status 2

tar: Error is not recoverable: exiting now

    at ChildProcess.exithandler (child_process.js:303:12)

    at ChildProcess.emit (events.js:310:20)

    at maybeClose (internal/child_process.js:1021:16)

    at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)

原因:看日志里面是通过命令:tar jxf /tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2来去解压的

这个是我的服务器上没有安装bzip2的包,用 yum install -y bzip2 安装一下即可

备注:日志中出现下载https://github.com/Medium/phantomjs/releases/download/v1.9.19/phantomjs-1.9.8-linux-x86_64.tar.bz2,网络还算给力,能够下下来,如果出现下载失败的情况,可以手动下载后上传到对应的目录


Done, without errors.

no binary file found

build/script/download-tomcat.sh:行36: wget: 未找到命令

Download tomcat failed

tar (child): build/apache-tomcat-7.0.91.tar.gz:无法 open: 没有那个文件或目录

tar (child): Error is not recoverable: exiting now

tar: Child returned status 2

tar: Error is not recoverable: exiting now

mv: 无法获取"build/apache-tomcat-7.0.91" 的文件状态(stat): 没有那个文件或目录

mv: 无法获取"build/tomcat/conf/server.xml" 的文件状态(stat): 没有那个文件或目录

cp: 无法创建普通文件"build/tomcat/conf/server.xml": 没有那个文件或目录

cp: 无法创建普通文件"build/tomcat/conf/server.xml.init": 没有那个文件或目录

server.xml overwritten...

mv: 无法获取"build/tomcat/conf/context.xml" 的文件状态(stat): 没有那个文件或目录

cp: 无法创建普通文件"build/tomcat/conf/context.xml": 没有那个文件或目录

context.xml overwritten...

cp: 无法获取"build/tomcat/conf/catalina.properties" 的文件状态(stat): 没有那个文件或目录

sed:无法读取 build/tomcat/conf/catalina.properties:没有那个文件或目录

sed:无法读取 build/tomcat/conf/catalina.properties:没有那个文件或目录

catalina.properties overwritten...

version 2.6.0

cp: 无法创建普通文件"build/tomcat/lib/kylin-tomcat-ext-2.6.0.jar": 没有那个文件或目录

chmod: 无法访问"build/tomcat/lib/kylin-tomcat-ext-2.6.0.jar": 没有那个文件或目录

原因:wget命令未找到 导致无法下载tomcat 需要安装一下 yum install -y wget

三、编译技巧

在apache-kylin-2.6.0/build/script包下有2个download的shell脚本

从download-spark.sh中可以看出会去下载spark包:http://archive.apache.org/dist/spark/spark-2.3.2/spark-2.3.2-bin-hadoop2.7.tgz到 apache-kylin-2.6.0/build目录下

从download-tomcat.sh中可以看出会去下载tomcat包:http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.91/bin/apache-tomcat-7.0.91.tar.gz到apache-kylin-2.6.0/build目录下

这种可以提前下载好上传到对应目录下,可以避免编译时间过长,或者因网络原因导致失败

四、编译成功

当看到日志:Package ready: dist/apache-kylin-2.6.0-bin.tar.gz就表示编译成功了

最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容