Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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="rsync.destination.host" value="remote.example.com"/>
<!-- 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/remote.example.com.key"/>
<!-- 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.host}:${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.host}:${rsync.destination.dir}"/>
</exec>
</target>
</project>
Owner

rmcfrazier commented Jul 8, 2012

Please see my blog post for an explanation on how to use this eclipse ant-based builder.
http://blog.robert.mcfrazier.com/rsync-on-save-in-eclipse-on-osx/

khards commented May 19, 2017

Cheers!

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