Skip to content

Instantly share code, notes, and snippets.

Created July 3, 2012 21:40
Show Gist options
  • Save rmcfrazier/3043480 to your computer and use it in GitHub Desktop.
Save rmcfrazier/3043480 to your computer and use it in GitHub Desktop.
Ant builder to rsync on save in eclipse
<?xml version="1.0" encoding="UTF-8"?>
<project name="Rsync On Save" basedir="." default="rsync">
<description>Builder for eclipse to rsync on save for OSX.</description>
<!-- local source directory for rsync (read from this directory) -->
<property name="rsync.source.dir" value="${basedir}"/>
<!-- remote rsync host -->
<property name="" value=""/>
<!-- remote rsync directory (write to this directory) -->
<property name="rsync.destination.dir" value="/var/www/wp-content/plugins/rob-tester"/>
<!-- filepath to the ssh key-->
<property name="rsync.ssh.key" value="/Users/rmcfrazier/my-keys/"/>
<!-- ssh user to login to remote -->
<property name="rsync.ssh.user" value="ssh-user"/>
<target name="rsync">
<echo message="Rsync source:"/>
<echo message="${rsync.source.dir}"/>
<echo message="Rsync destination:"/>
<echo message="${rsync.ssh.user}@${}:${rsync.destination.dir}"/>
<exec dir="." executable="rsync">
<arg value="-arv"/>
<!-- exclude all hidden files and directories -->
<arg line="--exclude='.*'"/>
<!-- exclude build.xml and rsync.xml -->
<arg line="--exclude='build.xml'"/>
<arg line="--exclude='rsync.xml'"/>
<!-- variable that holds the filepath to the ssh key -->
<arg line="-e &quot;ssh -i ${rsync.ssh.key}&quot;"/>
<!-- local directory that is the source for the rsync -->
<arg value="${rsync.source.dir}"/>
<!-- remote host and directory destination for rsync -->
<arg value="${rsync.ssh.user}@${}:${rsync.destination.dir}"/>
Copy link

Please see my blog post for an explanation on how to use this eclipse ant-based builder.

Copy link

khards commented May 19, 2017


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment