编译hadoop-eclipse-plugin-1.1.2.jar插件
来源:互联网 发布:淘宝卖家设置淘宝客 编辑:程序博客网 时间:2024/04/28 15:09
hadoop自0.20.x版本后不再提供现成的hadoop-eclipse插件而是给出了源码自行编译。
- 使用任意一个workspace打开你的eclipse
- 把Hadoop程序目录的src/contrib的eclipse-plugin项目导入到eclipse
- 导入eclipse后,项目名称会变成MapReduceTools。修改你的编译环境(jdk环境)
- 在项目的根目录下创建一个新的Build.xml文件 ,名字可以随意取,不要跟已有的重复就行,这里我取名为MyBuild.xml。编辑该文件,文件内容如下(用户需根据自己电脑上Hadoop程序版本,存放位置,及eclipse的安装位置做相应的修改):
<project default= "jar" name ="eclipse-plugin">
<property name= "name" value ="${ant.project.name}" />
<property name= "root" value ="${basedir}" />
<property name= "hadoop.root" location ="E:\Hadoop\hadoop-1.1.2" />
<property name= 'version' value ='1.1.2' />
<property name= 'eclipse.home' location ='E:\android\eclipse' />
<property name= "build.dir" location ="${hadoop.root}/build/contrib/${name}" />
<property name= "build.classes" location ="${build.dir}/classes" />
<property name= "src.dir" location ="${root}/src/java" />
<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.ssh2*.jar" />
<include name= "com.jcraft.jsch*.jar" />
</fileset>
</path>
<!-- Override classpath to include Eclipse SDK jars -->
<path id= "classpath">
<fileset dir= "${hadoop.root}">
<include name= "*.jar" />
</fileset>
<path refid= "eclipse-sdk-jars" />
</path>
<target name= "compile">
<mkdir dir= "${build.dir}/classes" />
<javac encoding= "ISO-8859-1" srcdir ="${src.dir}" includes="**/*.java"
destdir= "${build.classes}" debug ="on" deprecation= "off">
<classpath refid= "classpath" />
</javac>
</target>
<target name= "jar" depends ="compile">
<mkdir dir= "${build.dir}/lib" />
<copy file= "${hadoop.root}/hadoop-core-${version}.jar" tofile="${build.dir}/lib/hadoop-core.jar"
verbose= "true" />
<copy file= "${hadoop.root}/lib/commons-cli-1.2.jar" todir="${build.dir}/lib"
verbose= "true" />
<copy file= "${hadoop.root}/lib/commons-configuration-1.6.jar"
todir= "${build.dir}/lib" verbose ="true" />
<copy file= "${hadoop.root}/lib/commons-httpclient-3.0.1.jar"
todir= "${build.dir}/lib" verbose ="true" />
<copy file= "${hadoop.root}/lib/jackson-core-asl-1.8.8.jar" todir="${build.dir}/lib"
verbose= "true" />
<copy file= "${hadoop.root}/lib/commons-lang-2.4.jar" todir="${build.dir}/lib"
verbose= "true" />
<copy file= "${hadoop.root}/lib/jackson-mapper-asl-1.8.8.jar"
todir= "${build.dir}/lib" verbose ="true" />
<jar jarfile= "${build.dir}/hadoop-${name}-${version}.jar"
manifest= "${root}/META-INF/MANIFEST.MF" >
<fileset dir= "${build.dir}" includes ="classes/ lib/" />
<fileset dir= "${root}" includes ="resources/ plugin.xml" />
</jar>
</target>
</project>
5. 修改META-INF/MANIFEST.MF文件内容,修改成如下:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: MapReduce Tools for Eclipse
Bundle-SymbolicName: org.apache.hadoop.eclipse;singleton:=true
Bundle-Version: 0.18
Bundle-Activator: org.apache.hadoop.eclipse.Activator
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.jdt.launching,
org.eclipse.debug.core,
org.eclipse.jdt,
org.eclipse.jdt.core,
org.eclipse.core.resources,
org.eclipse.ui.ide,
org.eclipse.jdt.ui,
org.eclipse.debug.ui,
org.eclipse.jdt.debug.ui,
org.eclipse.core.expressions,
org.eclipse.ui.cheatsheets,
org.eclipse.ui.console,
org.eclipse.ui.navigator,
org.eclipse.core.filesystem,
org.apache.commons.logging
Eclipse-LazyStart: true
Bundle-ClassPath: classes/,lib/hadoop-core.jar,lib/commons-cli-1.2.jar,lib/commons-configuration-1.6.jar,lib/commons-httpclient-3.0.1.jar,lib/commons-lang-2.4.jar,lib/jackson-core-asl-1.8.8.jar,lib/jackson-mapper-asl-1.8.8.jar
Bundle-Vendor: Apache Hadoop
最后一步:右键MyBuild.xml文件 ->run as->Ant Bulid。 编译成功后,就可以在${build.dir}目录下找到hadoop-eclipse-plugin-1.1.2.jar。
- 几个注意点
1. 一定要在网络环境下进行,如果需要设置上网代理,可以在src\contrib\build-contrib.xml中添加如下几行:
<target name="proxy" > <property name="proxy.host" value="132.96.27.24"/> <property name="proxy.port" value="80"/> <property name="proxy.user" value=""/> <property name="proxy.pass" value=""/> <setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}" proxyuser="${proxy.user}" proxypassword="${proxy.pass}"/> </target>
在xml文件中的ivy相关文件的下载任务中,添加以上代理任务的依赖,配置为:
<target name="ivy-download" depends="proxy" description="To download ivy " unless="offline"> <get src="${ivy_repo_url}" dest="${ivy.jar}" usetimestamp="true"/> </target>
2. 如果出现编译提示类的版本不匹配的问题,请确认你的java版本大于1.6。
0 0
- 编译hadoop-eclipse-plugin-1.1.2.jar插件
- 编译hadoop-eclipse-plugin-1.1.2.jar插件
- windows下编译hadoop-eclipse-plugin-1.1.2.jar插件
- Linux下Ant编译Hadoop-eclipse-plugin-2.x.x.jar插件
- 编译hadoop的eclipse插件hadoop-eclipse-plugin-1.2.1.jar
- 编译hadoop的eclipse插件hadoop-eclipse-plugin-1.2.1.jar
- 编译Hadoop 2.x Hadoop-eclipse-plugin插件
- windows编译hadoop 2.x Hadoop-eclipse-plugin插件
- 编译hadoop 2.x Hadoop-eclipse-plugin插件
- windows编译hadoop 2.x Hadoop-eclipse-plugin插件
- Windows下编译hadoop 2.x Hadoop-eclipse-plugin插件
- windows编译hadoop 2.x Hadoop-eclipse-plugin插件
- 编译hadoop的eclipse插件hadoop-eclipse-plugin-1.2.1.jar 【用来管理hadoop的HDFS和开发MapReduce项目】
- hadoop-eclipse-plugin-2.x.x 插件编译
- hadoop-1.0.4编译eclipse plugin插件
- Ant编译eclipse hadoop plugin插件
- 用Ant编译eclipse hadoop plugin插件
- hadoop-1.0.4 eclipse-plugin插件编译
- A sequence of numbers
- 0400000149
- 0400000150
- yii 和 zend studio 集成
- 0400000151
- 编译hadoop-eclipse-plugin-1.1.2.jar插件
- 关于rand()函数srand()函数的使用(转)
- 0400000152
- java中的数据结构
- 0400000153
- 0400000154
- 九度1140解题报告
- HDU1716-全排列
- 0400000155