One of my students at ITP just asked about file sync between one’s local file system to a remote file system using Eclipse and SFTP, so I put together a quick how-to, which might be of interest. The actual text/steps may vary, depending upon your version of Eclipse, but all the basics are there.
The one caveat of this process is that I’ve only been successful in setup and sync with an existing remote directory, and then importing it locally, not the other way around, e.g. exporting local to remote (though I have not tried very hard in this area — for whatever reason, the target has always existed whenever I’ve set up sync). So a remote target folder of some kind must already exist before you sync it to a local one, if you’re using these instructions.
To equate a local directory with a pre-existing remote one:
- Help > Software Updates
- Choose Available Software Tab
- Click Add Siteā¦, and then put http://eclipse.jcraft.com/ for the URL field.
- Choose SFTP Plug-in, and then click Install …, and then restart after the install
- Using Project Explorer view, make a new local project
- Create a folder within that project that will map to a remote folder
- Right click on the local folder in Project Explorer and choose Import
- In the Select dialog, choose Other > SFTP
- Choose the local folder as the one to receive the import
- Create a new SFTP site and give your host and login info
- If successfully connected to remote site, you should get the remote directory tree
- Choose the remote folder to import
- The remote files should now be in the local folder
Now to keep sync between these two:
- Go to Window > Show View > Other… > Team > Synchronize
- Click the first upper right icon in the Synchronize tab
- Choose SFTP from the Synchronize dialog
- The previously mapped folder should appear with all files selected
- Click Finish
- Eclipse will ask you if you want to use Team Synch perspective. Personally I don’t use this. I just keep the Synchronize view as part of my workbench
To test:
- Make a change in a file within the local folder
- It should then appear in the Synchronize view in Outgoing mode
- Using the buttons at the top of the Synchronize tab, or the right-click menus on any of the items that have changed, you can upload or check the diff between the local and remote counterpart
So there you have it. For projects that involve multiple people, I would recommend using a version control system like Subversion, but for quick one-person, one code-base jobs, this works nicely …