这篇文章将为大家详细讲解有关Pig-0.13.0如何编译,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。
1、下载pig到本地目录,运行ant。
[wukong@bd23 pig-0.13.0]$ ant clean jar-withouthadoop -Dhadoopversion=23 Buildfile: build.xml BUILD FAILED /home/wukong/usr/pig-0.13.0/build.xml:750: Problem: failed to create task or type scriptdef Cause: the class org.apache.tools.ant.taskdefs.optional.script.ScriptDef was not found. This looks like one of Ant's optional components. Action: Check that the appropriate optional JAR exists in -/usr/share/ant/lib -/home/wukong/.ant/lib -a directory added on the command line with the -lib argument Do not panic, this is a common problem. The commonest cause is a missing JAR. This is not a bug; it is a configuration problem Total time: 1 second
2、失败的原因是centos自带的ant功能不全(这一步的ant报错可参考Hadoop集群中pig工具的安装过程记录)。解决办法是自行安装ant最新版本(这里安装的是ant-1.9.4)并配置环境变量。以下是参考配置方法
[wukong@bd23 apache-ant-1.9.4]$ pwd /usr/local/apache-ant-1.9.4
[wukong@bd23 apache-ant-1.9.4]$ vim /etc/profile ...... export JAVA_HOME=/usr/local/jdk1.7.0_65 export ANT_HOME=/usr/local/apache-ant-1.9.4 export MAVEN_HOME=/usr/local/apache-maven-3.2.2 export CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib export PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$MAVEN_HOME/bin:$PATH
3、安装配置并source配置文件后,再次运行ant。经过大概一套煎饼果子加一碗豆腐脑的功夫,基本上就运行结束了。然后你会发现还是不对。。。
[wukong@bd23 pig-0.13.0]$ ant clean jar-withouthadoop -Dhadoopversion=23 ...... [ivy:resolve] http://repository.jboss.com/nexus/content/groups/public/org/mortbay/jetty/jetty/6.1.26/jetty-6.1.26.zip [ivy:resolve] ==== apache-snapshots: tried [ivy:resolve] http://repository.apache.org/content/groups/snapshots-group/org/mortbay/jetty/jetty/6.1.26/jetty-6.1.26.zip [ivy:resolve] :::::::::::::::::::::::::::::::::::::::::::::: [ivy:resolve] :: UNRESOLVED DEPENDENCIES :: [ivy:resolve] :::::::::::::::::::::::::::::::::::::::::::::: [ivy:resolve] :: com.sun.jersey#jersey-bundle;1.8: not found [ivy:resolve] :: com.sun.jersey#jersey-server;1.8: not found [ivy:resolve] :: com.sun.jersey.contribs#jersey-guice;1.8: configuration not found in com.sun.jersey.contribs#jersey-guice;1.8: 'master'. It was required from org.apache.pig#pig;0.13.1-SNAPSHOT hadoop23 [ivy:resolve] :::::::::::::::::::::::::::::::::::::::::::::: [ivy:resolve] :::::::::::::::::::::::::::::::::::::::::::::: [ivy:resolve] :: FAILED DOWNLOADS :: [ivy:resolve] :: ^ see resolution messages for details ^ :: [ivy:resolve] :::::::::::::::::::::::::::::::::::::::::::::: [ivy:resolve] :: org.mortbay.jetty#jetty;6.1.26!jetty.zip [ivy:resolve] :::::::::::::::::::::::::::::::::::::::::::::: [ivy:resolve] :::: ERRORS [ivy:resolve] SERVER ERROR: Connection timed out url=http://repo2.maven.org/maven2/xmlenc/xmlenc/0.52/xmlenc-0.52-sources.jar [ivy:resolve] SERVER ERROR: Connection timed out url=http://repo2.maven.org/maven2/xmlenc/xmlenc/0.52/xmlenc-0.52-src.jar [ivy:resolve] SERVER ERROR: Connection timed out url=http://repo2.maven.org/maven2/xmlenc/xmlenc/0.52/xmlenc-0.52-javadoc.jar [ivy:resolve] SERVER ERROR: Connection timed out url=http://repo2.maven.org/maven2/com/sun/jersey/jersey-bundle/1.8/jersey-bundle-1.8.pom [ivy:resolve] SERVER ERROR: Connection timed out url=http://repo2.maven.org/maven2/com/sun/jersey/jersey-bundle/1.8/jersey-bundle-1.8.jar [ivy:resolve] SERVER ERROR: Backend is unhealthy url=http://repo2.maven.org/maven2/com/sun/jersey/jersey-server/1.8/jersey-server-1.8.pom [ivy:resolve] SERVER ERROR: Connection timed out url=http://repo2.maven.org/maven2/com/sun/jersey/jersey-server/1.8/jersey-server-1.8.jar [ivy:resolve] SERVER ERROR: Connection timed out url=http://repo2.maven.org/maven2/com/sun/jersey/contribs/jersey-guice/1.8/jersey-guice-1.8.pom [ivy:resolve] [ivy:resolve] :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS BUILD FAILED /home/wukong/usr/pig-0.13.0/build.xml:1599: impossible to resolve dependencies: resolve failed - see output for details Total time: 13 minutes 25 seconds
4、导致以上问题的原因是下载jersey-1.8和jetty-6.1.26失败。所以要下载并且导入maven。导入命令如下
mvn install:install-file -Dfile=外部包的路径 \ -DgroupId=外部包的groupId \ -DartifactId=外部包的artifactId \ -Dversion=外部包的版本号 \ -Dpackaging=jar
[wukong@bd23 pig-0.13.0]$ mvn install:install-file -Dfile=/home/wukong/res/jersey-archive-1.18.zip -DgroupId=com.sun.jersey -DartifactId=jersey-core -Dversion=1.8 -Dpackaging=zip
[wukong@bd23 pig-0.13.0]$ mvn install:install-file -Dfile=/home/wukong/res/jetty-6.1.26.zip -DgroupId=org.mortbay.jetty -DartifactId=jetty -Dversion=6.1.26 -Dpackaging=zip
5、导入后再次编译,发现还是不行。真泥马坑爹。。
[ivy:resolve] :: problems summary :: [ivy:resolve] :::: WARNINGS [ivy:resolve] :::::::::::::::::::::::::::::::::::::::::::::: [ivy:resolve] :: UNRESOLVED DEPENDENCIES :: [ivy:resolve] :::::::::::::::::::::::::::::::::::::::::::::: [ivy:resolve] :: com.sun.jersey.contribs#jersey-guice;1.8: configuration not found in com.sun.jersey.contribs#jersey-guice;1.8: 'master'. It was required from org.apache.pig#pig;0.13.1-SNAPSHOT hadoop23 [ivy:resolve] :::::::::::::::::::::::::::::::::::::::::::::: [ivy:resolve] [ivy:resolve] :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS BUILD FAILED /home/wukong/usr/pig-0.13.0/build.xml:1599: impossible to resolve dependencies: resolve failed - see output for details
6、然后再在maven中安装jersey-guice-1.8
[wukong@bd23 pig-0.13.0]$ mvn install:install-file -Dfile=/home/wukong/res/jersey-guice-1.8.jar -DgroupId=com.sun.jersey.contribs -DartifactId=jersey-guice -Dversion=1.8 -Dpackaging=jar
7、再次用ant build pig。终于过了!
关于“Pig-0.13.0如何编译”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。