Executing remote script via ant

Posted Over 9 years ago. Visible to the public.

Following ant build script to help you to execute command in remote server.

<?xml version="1.0"?>
    <project basedir="." default = "build">
        <target name="build" description="Running test" >
            <path id="jsch.class.path">    
                <pathelement location="/usr/share/ant/lib/ant-jsch-1.9.2.jar" />
                <pathelement location="/usr/share/ant/lib/jsch-0.1.51.jar" />
            </path>
            <taskdef name="scp" classname="org.apache.tools.ant.taskdefs.optional.ssh.Scp" classpathref="jsch.class.path" />
            <taskdef name="sshexec" classname="org.apache.tools.ant.taskdefs.optional.ssh.SSHExec" classpathref="jsch.class.path" />
            <sshexec trust="true"  
            host="192.168.10.97" 
            username="xxxxx" 	
            verbose="true"
            password="xxxxx"
            command="mkdir /home/xxxx/xxx"
            failonerror="true"/>

        </target>
    </project>
vasan
Last edit
Over 9 years ago
vasan
Keywords
Ant
Posted by vasan to vasan's deck (2014-09-11 11:10)