jclouds/antcontrib/samples/javaoverssh/build.xml

84 lines
2.6 KiB
XML

<?xml version="1.0"?>
<!--
Licensed to jclouds, Inc. (jclouds) under one or more
contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. jclouds 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 name="sshjava" default="sshjava" basedir=".">
<description>
simple example build file
</description>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<input
message="Please enter the ip or hostname of the ssh machine"
addproperty="host"
/>
<input
message="Please enter the user you will connect as"
addproperty="username"
/>
<input
message="Please enter the path to the dsa key"
addproperty="keyfile"
/>
<input
message="Please enter the strings you'd like to test"
addproperty="line"
/>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="init" description="compile the source ">
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}"/>
</target>
<target name="clean" description="clean up">
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
<taskdef name="sshjava" classname="org.jclouds.tools.ant.taskdefs.sshjava.SSHJava" />
<target name="sshjava" depends="compile" description="remote execute the java command">
<echo message="normal java task"/>
<java classname="TestClass" classpath="${build}" dir="${user.dir}" >
<arg line="${line}"/>
</java>
<echo message="java task over ssh"/>
<sshjava classname="TestClass" classpath="${build}" dir="${user.dir}" host="${host}" username="${username}" keyfile="${keyfile}" trust="true" remotebase="/tmp/test" >
<arg line="${line}"/>
</sshjava>
</target>
</project>