linux编译kite和hbase

来源:互联网 发布:sql入门新手教程 编辑:程序博客网 时间:2024/05/29 12:29

1、编译kite遇到的问题及方法

配置vim参数

vim ~/.vimrcset fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936set termencoding=utf-8set encoding=utf-8

设置java环境变量与中文显示

export LC_ALL=Cexport JAVA_HOME=/usr/lib/jvm/java-7-openjdk-ppc64elexport PATH=$JAVA_HOME/bin:$PATH:$HOME/binexport CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib

编译kite记录

在下载下面这个链接时卡着不动,错误原因为该链接失效了,需要重新指定新的链接地址
http://maven.twttr.com/net/sf/jung/jung-api/2.0.1/jung-api-2.0.1.pom

在google上查找所需要的文件

例如 jung-api-2.0.1.pom
找到新的链接地址为
https://repo1.maven.org/mavn2/net/sf/jung/jung-api/2.0.1/jung-api-2.0.1.pom

更换链接地址

先找到要更换的 地址在哪里

grep twttr* -R

然后打开找到的xml文件,把对应的IP地址替换即可。(注意:只用替换地址的前半部分使之能重合起来)

具体操作如下

在kite-1.0.0+cdh5.8.3+139/pom.xml中添加

<repository><id>nexus.axiomalaska.com</id><url>http://nexus.axiomalaska.com/nexus/content/repositories/public</url></repository><repository><id>repo1.maven.org</id><url>https://repo1.maven.org/maven2</url><releases>    <enabled>true</enabled></releases><snapshots>    <enabled>true</enabled></snapshots></repository><repository><id>cwiki.apache.org</id><url>http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionExeption</url></repository><repository><id>repo.maven.apache.org</id><url>http://repo.maven.apache.org/maven2</url></repository><repository><id>org.pentaho</id><url>http://www.conjars.org/org.pentaho/pentaho-aggdesigner-algorithm/versions/5.1.5-jhyde</url></repository>另外你还要注释掉之前的源<!-- <repository><id>maven-twttr</id><url>http://maven.twttr.com</url><layout>default</layout><releases>    <enabled>true</enabled></releases><snapshots>    <enabled>true</enabled></snapshots></repository>-->

报错提示

[ERROR] Failed to execute goal on project kite-morphlines-useragent: Could not resolve dependencies for project org.kitesdk:kite-morphlines-useragent:jar:1.0.0-cdh5.8.3: Failure to find ua_parser:ua-parser:jar:1.3.0 in https://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of repo1.maven.org has elapsed or updates are forced -> [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/DependencyResolutionException[ERROR][ERROR] After correcting the problems, you can resume the build with the command[ERROR]   mvn <goals> -rf :kite-morphlines-useragentdebian/rules:38: recipe for target 'override_dh_auto_build' failedmake[1]: *** [override_dh_auto_build] Error 1make[1]: Leaving directory '/packages/kite/kite-1.0.0+cdh5.8.3+139'debian/rules:35: recipe for target 'build' failedmake: *** [build] Error 2dpkg-buildpackage: error: debian/rules build gave error exit status 2

解决方法

发现它是对kite-morphlines-useragent的编译,需要依赖 ua_parser:ua-parser:jar:1.3.0,变通一点,先绕过它再说,在kite-1.0.0+cdh5.8.3+13a9/pom.xml 中,
注释掉<module>kite-morphlines</module>,最后可以愉快的看到 [INFO] BUILD SUCCESS 啦

2、编译hbase遇到的问题及解决方法

命令总结

打包:mvn package
编译:mvn compile
编译测试程序:mvn test-compile
清空:mvn clean
运行测试:mvn test
生成站点目录: mvn site
生成站点目录并发布:mvn site-deploy
安装当前工程的输出文件到本地仓库: mvn install
打包不测试 
mvn package -DskipTests=true
mvn clean install -DskipTests=true
生成项目依赖的报表,这样你就能够在报表中找出你版本冲突的相关性依赖了
mvn project-info-reports:dependencies

先更改了pom.xml里面的错误的地址

这些地址必须在浏览器上必须能打开

<repositories><repository><id>cdh.repo</id><url>https://repository.cloudera.com/artifactory/cloudera-repos</url><name>Cloudera Repositories</name><snapshots><enabled>true</enabled></snapshots></repository><repository><id>cdh.snapshots.repo</id><url>https://repository.cloudera.com/artifactory/cloudera-repos/local-output/maven-repository/cdh-snapshot-local</url><name>Cloudera Snapshots Repository</name><snapshots><enabled>true</enabled></snapshots><releases><enabled>true</enabled></releases></repository><repository><id>cloudbees netty</id><url>https://repository.apache.org/content/repositories/snapshots/</url></repository><repository><id>apache release</id><url>https://repository.apache.org/content/repositories/releases/</url></repository><repository><id>java.net</id><name>Java.Net</name><url>https://repo1.maven.org/maven2</url><snapshots><enabled>true</enabled></snapshots><releases><enabled>true</enabled></releases></repository><repository><id>repository.jboss.org</id><url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url><snapshots><enabled>false</enabled></snapshots></repository><repository><id>ghelmling.testing</id><name>Gary Helmling test repo</name><url>http://people.apache.org/~garyh/mvn/</url><snapshots><enabled>true</enabled></snapshots><releases><enabled>true</enabled></releases></repository>

在dpkg-buildpack -nc之后有报错提示先执行下面两条命令

mvn clean install -Drat.skip=true
mvn clean install -DskipTests

跳过所有的单元测试

mvn clean install -Drat.skip=true

在执行完上面的命令之后遇到下面的报错

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project hbase-common: There are test failures.

出现上述类似错误的原因是以下几种:

1.出现这种情况是测试代码没有获得通过,如果maven项目是拷贝过来的,测试用例可能很诡异,不管怎么改就是不起作用,这时候把文件重构改下名字就行了,不能和原来的文件名一样,然后确保代码本身没错的情况下再进行,问题可能解决。

2.这是因为测试代码时遇到错误,会停止编译。
为了解决上面的问题我参考链接:http://stackoverflow.com/questions/13170860/failed-to-execute-goal-org-apache-maven-pluginsmaven-surefire-plugin2-10test

然后我在pom.xml中添加下面内容

<!--NEW-->231           <configuration>232                 <testFailureIgnore>true</testFailureIgnore>233           </configuration>

然后发现系统中定义的有。上述内容,导致冲突了
所以就把第1020行的false改为true具体如下

<surefire.testFailureIgnore>true</surefire.testFailureIgnore>

然后执行dpkg-buildpackage -nc继续编译,然后依然是上面的错误信息然后我又执行了一遍下面的命令

mvn clean install -Drat.skip=true

发现报错信息为

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.19.1:verify (verify) on project hbase-it: There are test failures.
[ERROR]
[ERROR] Please refer to /packages/hbase/hbase-1.2.0+cdh5.8.3+204/hbase-it/target/failsafe-reports for the individual test results.
[ERROR] -> [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/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :hbase-it

然后继续上网查找相关的信息,发现需要执行

mvn test -Dmaven.test.failure.ignore=true链接地址为:http://www.cnblogs.com/binyue/p/4721076.html

然后继续dpkg-buildpackage -nc出现报错信息为

[ERROR] Failed to execute goal org.apache.rat:apache-rat-plugin:0.11:check (default) on project hbase: Too many files with unapproved license: 1 See RAT report in: /packages/hbase/hbase-1.2.0+cdh5.8.3+204/target/rat.txt -> [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/MojoFailureException
debian/rules:42: recipe for target ‘override_dh_auto_build’ failed
make[1]: * [override_dh_auto_build] Error 1
make[1]: Leaving directory ‘/packages/hbase/hbase-1.2.0+cdh5.8.3+204’
debian/rules:39: recipe for target ‘build’ failed
make: * [build] Error 2

然后准备把debian包中的文件注释几行

vim debian/packaging_functions.sh

前12行和159和175行。编译依然不行错误和上面的一样

然后执行下面的命令打印debug

mvn -X install site -Pdist -DskipTests

错误信息和之前的一样都是有许多的未经授权的证书
然后在pom.xml文件中注释掉
modules

<!-- <module>hbase-testing-util</module>-->

依然不行就又把注销的变回来了!
然后我又执行了

mvn test -Dmaven.test.failure.ignore=treu

发现这个命令可以编过但是继续用

dpkg-buildpackage -nc

依然不行

执行

mvn -X install site -Pdist -DskipTests

这条命令用来显示每一步的debug

又查找了一遍报错信息说是 RAT正在检查flume目录中的所有文件以获取正确的许可证头。 您似乎有一个额外的文件没有正确的许可证头。 它的路径将存储在鼠标报告中在target rat.txt中。 我建议删除此文件具体参考链接为https://translate.google.co.jp/translate?hl=zh-CN&sl=en&tl=zh-CN&u=https%3A%2F%2Fissues.apache.org%2Fjira%2Fbrowse%2FFLUME-1372%3FfocusedCommentId%3D13414920%26page%3Dcom.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel
然后又查了一个信息如下
参考链接为:http://blog.csdn.net/zh_yi/article/details/43527175

编译Flume-ng时可能出现这个问题,apache的rat(Release Audit Tool)是一个用来检查软件发行的准确性和高效性的工具。它的本质是对可能出现的问题作出预测。我们从apache下载的源码,一般在java文件的开头会有针对Apache Software Foundation(ASF)的一些基本信息。表示的是apache的license信息。一般Maven工程的pom.xml文件中会有一个插件org.apache.rat。它在install或者deploy时会从Java文件确认license信息。如果没有找到就会报以上异常。
检查都有哪些文件的license信息有问题的方法是打开target/rat.txt文件,查找每行前面带“?”的,这行就是license出问题的类。如果是Apache的源码一般前面会显示AL(Apache License)。有人说可以删除对应类。但不建议这样做,可以从没有问题的类中将文件头的license粘贴到该类的头部再重新编译即可成功。

看过这个之后我觉得是之前我编译pom.xml时把其中的开发人员选项给删除了造成的,然后我做了一下备份把有用的源的信息拷贝到du.xml中,然后把hbase包删除,重新下载
下载之后

首先

dpkg-source -x hbase

然后修改pom.xml文件把du.xml文件中的内容拷贝进来
然后修改debian/pack里面的 注销掉前几行和175和159
然后dpkg-source –commit
然后dpklg-buildpackage
报错
然后执行下面的命令

mvn clean install -Drat.skip=true

接下来准备执行下面的命令

mvntest -Dmaven.test.failure.ignore=true

接下来准备执行

dpkg-buildpackage -nc

遇到报错
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.0:site (default-site) on project hbase-checkstyle: Execution default-site of goal org.apache.maven.plugins:maven-site-plugin:3.0:site failed: Plugin org.apache.maven.plugins:maven-site-plugin:3.0 or one of its dependencies could not be resolved: Failed to collect dependencies for org.apache.maven.plugins:maven-site-plugin:jar:3.0 (): Failed to read artifact descriptor for org.apache.maven.reporting:maven-reporting-exec:jar:1.0.1: Could not transfer artifact org.apache.maven.reporting:maven-reporting-exec:pom:1.0.1 from/to cdh.releases.repo (https://repository.cloudera.com/content/repositories/cdh-releases-rcs): Connect to 121.69.130.52:8080 [/121.69.130.52] failed: Connection refused -> [Help 1
把pom.xml中的maven-site-plugin的版本号改成3.0
参考链接:http://stackoverflow.com/questions/13855700/suppress-javac-warning-is-internal-proprietary-api-and-may-be-removed-in-a-f

经过不断的更改最终编译成功
具体配置方法请参见目录中的pom.xml文件new部分增加的内容

原创粉丝点击