Ant构建hadoop工程

build.xml

<project name="zdemo-hadoop-debug" basedir="." default="prepare">
    <property name="myclasspath" value="/Users/zhangqingli/Documents/y/mylibs/hadoop/2.5.0/jar" />
    <property name="targettarname" value="zdemo-hadoop-debug.jar" />

    <target name="prepare">
        <delete dir="${basedir}/build/classes" />
        <mkdir dir="${basedir}/build/classes"/>
    </target>

    <path id="path1">
        <fileset dir="${myclasspath}">
            <include name="*.jar"/>
        </fileset>
    </path>
    <target name="compile" depends="prepare">
        <javac srcdir="${basedir}/src" destdir="${basedir}/build/classes" classpathref="path1" includeantruntime="true"/>
    </target>

    <target name="package" depends="compile">
        <jar destfile="${basedir}/build/${targettarname}" basedir="${basedir}/build/classes" />
    </target>

    <target name="ssh" depends="package">
        <scp todir="ubuntu@nimbusz:/opt/data" file="${basedir}/build/${targettarname}" password="xxx" />
        <sshexec command="/opt/module/hadoop-2.5.0/bin/hdfs dfs -rm -r /user/ubuntu/test/output" 
            host="xxx" username="xxx" password="xxx" failonerror="false"/>
        <sshexec command="/opt/module/hadoop-2.5.0/bin/yarn jar 
            /opt/data/zdemo-hadoop-debug.jar mr01.maxtemperature.MaxTemperatureApp 
            /user/ubuntu/test/maxtemperature /user/ubuntu/test/output" 
            host="xxx" username="xxx" password="xxx" />
    </target>
</project>


这里写图片描述

注:使用ant的sshexec功能需要加入 jsch-xxx.jar

这里写图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值