您好,登錄后才能下訂單哦!
這篇文章將為大家詳細講解有關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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。