您好,登錄后才能下訂單哦!
小編給大家分享一下如何編譯hadoop2.4.1插件,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!
操作于 win7 32位 Eclipse 4.1 Kepler
①下載插件源碼包
https://github.com/winghc/hadoop2x-eclipse-plugin
點擊右側(cè)download下載
解壓,打開解壓目錄“ xxxx\hadoop2x-eclipse-plugin-master\src\contrib”
②新建一個java項目
將contrib下的eclipse-plugin里面的內(nèi)容拷貝到j(luò)ava項目下實際上只要拷貝5個就好。
META-INF resources src build.properties plugin.xml
拷貝完成了。那么問題來了:
全是紅叉叉。。。(個人有很多紅叉叉網(wǎng)上資料全都沒有描述,解決后記錄下。)
好像有個包名錯了。。這個自己改吧- -不解釋;
缺少一些jar包,(不小心放了漢化包。。以中文的描述吧問題不難,英文的相信你們對應(yīng)的上)
缺少的第一部分jar包為"插件依賴項":右鍵項目->構(gòu)建路徑->配置構(gòu)建路徑->然后添加庫->插件依賴項 下一步完成!
還有錯。。。少jar包。
這個jar包不截圖了大概就是少org.apache.hadoop.fs 類似的
大家都說去源碼包lib下找到j(luò)ar包全部引入就好。。。可是我的lib下面沒有啊- -真的沒有啊啊啊啊。。。
所以不要糾結(jié)了- -(認真你就輸了,這個錯誤可以繼續(xù)后續(xù)編譯,編譯完成了,jar包就來了所以不要在這些jar包上找方法了)。
③修改build.xml文件
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <project default="jar" name="eclipse-plugin"> <property name="jdk.home" value="C:\Program Files\Java\jdk1.7.0_55" /> <property name="hadoop.version" value="2.4.1" /> <property name="hadoop.home" value="E:\hadoop\hadoop-2.4.1\hadoop-2.4.1" /> <property name="eclipse.version" value="4.3" /> <property name="eclipse.home" value="E:\eclipse" /> <property name="root" value="${basedir}" /> <property file="${root}/build.properties" /> <property name="name" value="${ant.project.name}" /> <property name="src.dir" location="${root}/src" /> <property name="build.contrib.dir" location="${root}/build/contrib" /> <property name="build.dir" location="${build.contrib.dir}/${name}" /> <property name="build.classes" location="${build.dir}/classes" /> <property name="javac.deprecation" value="off" /> <property name="javac.debug" value="on" /> <property name="build.encoding" value="UTF-8" /> <path id="eclipse-sdk-jars"> <fileset dir="${eclipse.home}/plugins/"> <include name="org.eclipse.ui*.jar" /> <include name="org.eclipse.jdt*.jar" /> <include name="org.eclipse.core*.jar" /> <include name="org.eclipse.equinox*.jar" /> <include name="org.eclipse.debug*.jar" /> <include name="org.eclipse.osgi*.jar" /> <include name="org.eclipse.swt*.jar" /> <include name="org.eclipse.jface*.jar" /> <include name="org.eclipse.team.cvs.ssh3*.jar" /> <include name="com.jcraft.jsch*.jar" /> </fileset> </path> <path id="project-jars"> <fileset file="${build.dir}/lib/*.jar" /> </path> <target name="init" unless="skip.contrib"> <echo message="contrib: ${name}" /> <mkdir dir="${build.dir}" /> <mkdir dir="${build.classes}" /> <mkdir dir="${build.dir}/lib" /> <copy todir="${build.dir}/lib/" verbose="true"> <fileset dir="${hadoop.home}/share/hadoop/mapreduce"> <include name="hadoop*.jar" /> <exclude name="*test*" /> <exclude name="*example*" /> </fileset> <fileset dir="${hadoop.home}/share/hadoop/common"> <include name="hadoop*.jar" /> <exclude name="*test*" /> <exclude name="*example*" /> </fileset> <fileset dir="${hadoop.home}/share/hadoop/hdfs"> <include name="hadoop*.jar" /> <exclude name="*test*" /> <exclude name="*example*" /> </fileset> <fileset dir="${hadoop.home}/share/hadoop/yarn"> <include name="hadoop*.jar" /> <exclude name="*test*" /> <exclude name="*example*" /> </fileset> <fileset dir="${hadoop.home}/share/hadoop/common/lib"> <include name="protobuf-java-*.jar" /> <include name="log4j-*.jar" /> <include name="commons-cli-*.jar" /> <include name="commons-collections-*.jar" /> <include name="commons-configuration-*.jar" /> <include name="commons-lang-*.jar" /> <include name="jackson-core-asl-*.jar" /> <include name="jackson-mapper-asl-*.jar" /> <include name="slf4j-log4j12-*.jar" /> <include name="slf4j-api-*.jar" /> <include name="guava-*.jar" /> <include name="hadoop-annotations-*.jar" /> <include name="hadoop-auth-*.jar" /> <include name="commons-cli-*.jar" /> <include name="netty-*.jar" /> </fileset> </copy> </target> <target name="compile" depends="init" unless="skip.contrib"> <echo message="contrib: ${name}" /> <javac fork="true" executable="${jdk.home}/bin/javac" encoding="${build.encoding}" srcdir="${src.dir}" includes="**/*.java" destdir="${build.classes}" debug="${javac.debug}" deprecation="${javac.deprecation}" includeantruntime="on"> <classpath refid="eclipse-sdk-jars" /> <classpath refid="project-jars" /> </javac> </target> <target name="jar" depends="compile" unless="skip.contrib"> <pathconvert property="mf.classpath" pathsep=",lib/"> <path refid="project-jars" /> <flattenmapper /> </pathconvert> <jar jarfile="${build.dir}/hadoop-${hadoop.version}-eclipse-${eclipse.version}-plugin.jar" manifest="${root}/META-INF/MANIFEST.MF"> <manifest> <attribute name="Bundle-ClassPath" value="classes/,lib/${mf.classpath}" /> </manifest> <fileset dir="${build.dir}" includes="classes/ lib/" /> <fileset dir="${root}" includes="resources/ plugin.xml" /> </jar> </target> <target name="clean"> <echo message="contrib: ${name}" /> <delete dir="${build.dir}" /> </target> </project>
修改前5項:
jdk.home指定編譯時用的jdk,
hadoop和eclipse版本號是用來給jar起名字的,
hadoop.home是hadoop安裝目錄,會從里面提取需要的文件,
eclipse.home是eclipse的安裝目錄,MyEclipse中是那個Common目錄。
everything is ok! 右鍵build.xml文件Run AS Ant Build
Buildfile: E:\workspace\hadoop2x\build.xml init: [echo] contrib: eclipse-plugin [mkdir] Created dir: E:\workspace\hadoop2x\build\contrib\eclipse-plugin [mkdir] Created dir: E:\workspace\hadoop2x\build\contrib\eclipse-plugin\classes [mkdir] Created dir: E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib [copy] Copying 35 files to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\yarn\hadoop-yarn-api-2.4.1.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\hadoop-yarn-api-2.4.1.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\yarn\hadoop-yarn-applications-distributedshell-2.4.1.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\hadoop-yarn-applications-distributedshell-2.4.1.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\yarn\hadoop-yarn-applications-unmanaged-am-launcher-2.4.1.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\hadoop-yarn-applications-unmanaged-am-launcher-2.4.1.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\yarn\hadoop-yarn-client-2.4.1.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\hadoop-yarn-client-2.4.1.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\yarn\hadoop-yarn-common-2.4.1.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\hadoop-yarn-common-2.4.1.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\yarn\hadoop-yarn-server-applicationhistoryservice-2.4.1.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\hadoop-yarn-server-applicationhistoryservice-2.4.1.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\yarn\hadoop-yarn-server-common-2.4.1.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\hadoop-yarn-server-common-2.4.1.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\yarn\hadoop-yarn-server-nodemanager-2.4.1.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\hadoop-yarn-server-nodemanager-2.4.1.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\yarn\hadoop-yarn-server-resourcemanager-2.4.1.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\hadoop-yarn-server-resourcemanager-2.4.1.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\yarn\hadoop-yarn-server-web-proxy-2.4.1.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\hadoop-yarn-server-web-proxy-2.4.1.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\common\hadoop-common-2.4.1.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\hadoop-common-2.4.1.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\common\hadoop-nfs-2.4.1.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\hadoop-nfs-2.4.1.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\hdfs\hadoop-hdfs-2.4.1.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\hadoop-hdfs-2.4.1.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\hdfs\hadoop-hdfs-nfs-2.4.1.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\hadoop-hdfs-nfs-2.4.1.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\common\lib\commons-cli-1.2.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\commons-cli-1.2.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\common\lib\commons-collections-3.2.1.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\commons-collections-3.2.1.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\common\lib\commons-configuration-1.6.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\commons-configuration-1.6.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\common\lib\commons-lang-2.6.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\commons-lang-2.6.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\common\lib\guava-11.0.2.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\guava-11.0.2.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\common\lib\hadoop-annotations-2.4.1.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\hadoop-annotations-2.4.1.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\common\lib\hadoop-auth-2.4.1.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\hadoop-auth-2.4.1.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\common\lib\jackson-core-asl-1.8.8.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\jackson-core-asl-1.8.8.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\common\lib\jackson-mapper-asl-1.8.8.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\jackson-mapper-asl-1.8.8.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\common\lib\log4j-1.2.17.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\log4j-1.2.17.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\common\lib\netty-3.6.2.Final.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\netty-3.6.2.Final.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\common\lib\protobuf-java-2.5.0.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\protobuf-java-2.5.0.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\common\lib\slf4j-api-1.7.5.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\slf4j-api-1.7.5.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\common\lib\slf4j-log4j12-1.7.5.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\slf4j-log4j12-1.7.5.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\mapreduce\hadoop-mapreduce-client-app-2.4.1.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\hadoop-mapreduce-client-app-2.4.1.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\mapreduce\hadoop-mapreduce-client-common-2.4.1.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\hadoop-mapreduce-client-common-2.4.1.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\mapreduce\hadoop-mapreduce-client-core-2.4.1.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\hadoop-mapreduce-client-core-2.4.1.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\mapreduce\hadoop-mapreduce-client-hs-2.4.1.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\hadoop-mapreduce-client-hs-2.4.1.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\mapreduce\hadoop-mapreduce-client-hs-plugins-2.4.1.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\hadoop-mapreduce-client-hs-plugins-2.4.1.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\mapreduce\hadoop-mapreduce-client-jobclient-2.4.1.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\hadoop-mapreduce-client-jobclient-2.4.1.jar [copy] Copying E:\hadoop\hadoop-2.4.1\hadoop-2.4.1\share\hadoop\mapreduce\hadoop-mapreduce-client-shuffle-2.4.1.jar to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\lib\hadoop-mapreduce-client-shuffle-2.4.1.jar compile: [echo] contrib: eclipse-plugin [javac] Compiling 45 source files to E:\workspace\hadoop2x\build\contrib\eclipse-plugin\classes [javac] 注: 某些輸入文件使用或覆蓋了已過時的 API。 [javac] 注: 有關(guān)詳細信息, 請使用 -Xlint:deprecation 重新編譯。 [javac] 注: 某些輸入文件使用了未經(jīng)檢查或不安全的操作。 [javac] 注: 有關(guān)詳細信息, 請使用 -Xlint:unchecked 重新編譯。 jar: [jar] Building jar: E:\workspace\hadoop2x\build\contrib\eclipse-plugin\hadoop-2.4.1-eclipse-4.3-plugin.jar BUILD SUCCESSFUL Total time: 11 seconds
BUILD SUCCESSFUL 看到這個字樣日子就美好了??梢栽陧椖坷镎业骄幾g好的東東 hadoop-2.4.1-eclipse-4.3-plugin.jar
以上是“如何編譯hadoop2.4.1插件”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學習更多知識,歡迎關(guān)注億速云行業(yè)資訊頻道!
免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。