这篇文章给大家分享的是有关Ant如何构建Hadoop程序的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。
Hadoop环境:VirtualBox5(三台),CentOS7,Hadoop2.7.1
开发环境:Windows7
<?xml version="1.0" encoding="UTF-8"?> <project name="wukong-practice-hadoop2" default="package" basedir="." > <property name="src.dir.main.java" location="src/main/java"/> <property name="src.dir.main.resources" location="src/main/resources"/> <property name="build.dir" location="build"/> <property name="build.dir.classes" location="build/classes"/> <property file="build.properties"/> <property name="jar.name" value="shell-0.1-snapshot.jar"/> <path id="classpath"> <!--<pathelement location="${build.dir.classes}"/>--> <path refid="hadoop-classpath"/> <path refid="hadoop-depend-classpath"/> </path> <path id="hadoop-classpath"> <fileset dir="${hadoop.dir}/share/hadoop/common"> <include name="**/*.jar"/> </fileset> <fileset dir="${hadoop.dir}/share/hadoop/hdfs"> <include name="**/*.jar"/> </fileset> <fileset dir="${hadoop.dir}/share/hadoop/mapreduce"> <include name="**/*.jar"/> </fileset> <fileset dir="${hadoop.dir}/share/hadoop/yarn"> <include name="**/*.jar"/> </fileset> </path> <path id="hadoop-depend-classpath"> <fileset dir="${hadoop.dir}/share/hadoop/common/lib"> <include name="**/*.jar"/> </fileset> <fileset dir="${hadoop.dir}/share/hadoop/hdfs/lib"> <include name="**/*.jar"/> </fileset> <fileset dir="${hadoop.dir}/share/hadoop/mapreduce/lib"> <include name="**/*.jar"/> </fileset> <fileset dir="${hadoop.dir}/share/hadoop/yarn/lib"> <include name="**/*.jar"/> </fileset> </path> <target name="info"> <echo>build wukong-practice-hadoop2....</echo> <echo>hadoop-path: ${hadoop.path}</echo> </target> <target name="clean"> <delete dir="${build.dir}/**"/> </target> <target name="compile" depends="clean"> <mkdir dir="${build.dir.classes}"/> <copy todir="${build.dir.classes}" verbose="true"> <fileset dir="${src.dir.main.resources}"> <exclude name="META-INF/**"/> </fileset> </copy> <javac srcdir="${src.dir.main.java}" destdir="${build.dir.classes}" source="1.7" target="1.7" encoding="${compile.encoding}" classpathref="classpath" includeantruntime="false"> <!--<classpath refid="classpath"/>--> </javac> </target> <target name="package" depends="compile"> <pathconvert property="jar.classpath" pathsep=" " refid="classpath"> <map from="${hadoop.dir}" to="${hadoop.dir.linux}"/> </pathconvert> <!--<pathconvert property="jar.classpath" pathsep=" "> <mapper> <chainedmapper> <flattenmapper/> <globmapper from="*" to="lib/*"/> </chainedmapper> </mapper> <path refid="classpath"/> </pathconvert>--> <jar destfile="${build.dir}/${jar.name}" basedir="${build.dir.classes}"> <!--manifest="${src.main.resources}/META-INF/MANIFEST.MF">--> <manifest> <attribute name="Main-Class" value="band.wukong.practice.hadoop2.Commander"/> <attribute name="Class-Path" value="${jar.classpath}"/> </manifest> </jar> </target> </project>
version=0.1.0 compile.encoding=UTF-8 hadoop.dir=D:/Lab/lib/hadoop/hadoop-2.7.1 hadoop.dir.linux=/user/wukong/local/hadoop-2.7.1
感谢各位的阅读!关于“Ant如何构建Hadoop程序”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。