Implement Dreamweaver like FTP Upload On Save function to Eclipse without the need for ANT

This article written in mid 2009 is out of date.

One familiar problem with using Eclipse for web development is that it expects developers to run or compile sources on their local machines. Now this expectation is not really appropriate for many situations including HTML development where you develop on remote or virtual test servers. So we are going to customise Eclipse so it will automatically upload a file to a test server whenever it is saved, after editing.

Firstly this technique requires the use of the free Aptana plug-in for Eclipse. For those who don’t know, Aptana is a very functional IDE plug-in for Eclipse that puts a focus on web based development.

Assuming Aptana is installed and up and running we can go on. Firstly we need to change the Eclipse perspective to Aptana so we can be certain the correct menu options are available while you follow this tutorial.

The first thing you need to do is create a new folder ‘scripts’ in the root of the project where you wish to enable Upload Current File On Save. You can do this by selecting the project and then right-click, New > Folder.

Create folder

Now with your newly created scripts folder, right-click it. New > JavaScript File. With the New JavaScript File dialog save the script file as upload_current_file_on_save.js.

New JavaScript File

Once created, select from the Eclipse menu select Window > Open Perspective > Aptana

From the Eclipse menu select Window > Show Aptana View > Scripts

This should bring up a new window listing all the available Aptana customized scripts. In the Scripts dialog, scroll down to the bottom to the folder ‘Synchonize’. Look for, select and then right-click over the script ‘Upload Current File On Save’. Select ‘Edit Script’.

Scripts dialog

Select the body of the script [Ctrl A] and copy it to the clipboard [Ctrl C]. Open the blank upload_current_file_on_save.js you created earlier, paste the content of the clipboard into the file [Ctrl P]. Then save the modified file either with [Ctrl S] or using the Eclipse menu, File > Save.


Now we need to modify the script as by default it is disabled. On line 5 where it says * Menu: Synchonize > Upload Current File On Save; replace the word Synchonize to the name of your project or website. Save the changes. You should be able to test that everything is okay by going to the Scripts menu, there should be a sub-menu item with the name of your project or website with a Upload Current File On Save option.

Scripts Menu

Now back in the script window, go to line 12 which says // * Listener: commandService().addExecutionLister(this);
Remove the comments which are the two forward slashes, //. Select and cut the whole of line 12 and insert it to line 5 so it now sits above the *Menu: … item as shown below. Again save the file and you cna now close the Script edit tab.

Modified Script

Now the script is complete, we need to setup a FTP account.

In the Eclipse menu select Window > Show Aptana > View > Sync Manager

Right-click on Sync Manager and select Add Site Connection
A new dialog will come up, Create Site Connection.
Give a short but meaningful Connection name.
In the Path section, change the Local: from File to Project.
Browse for and select your project.

Now we add the FTP testing server details. In the same dialog, under Remote: + Select remote server, select Add New FTP (or SFTP, FTPS). Enter your site details and press Okay. Back in the Create Site Connection dialog, also press Okay.

Create an FTP connection

Now we are almost there all we need to do now is select the new connection to make sure it is used as default whenever we save a file within the project.

Right-click your project name, under the Project tab. Select Properties at the bottom of the right-click menu. In the Properties dialog click the Synchronization option near the bottom of the options. Change the Default Synchronization Connections to the one you previously created and make sure the Use Connection As Default checkbox is checked.

Default sync
Congratulations you now have enabled automatic uploads on save for your Eclipse project!

13 thoughts on “Implement Dreamweaver like FTP Upload On Save function to Eclipse without the need for ANT

  1. Hio,

    Well done, works also with newer versions…except, I got problems with php files. I heard, that this problem exists since Aptana1.6 has been released. Is there a solution for the php-problem?

  2. Nice write up, thank you. I really wish this could be done outside of a scripts folder in each project. Modifying the native script (adding a constructor method) still does not result in a global auto FTP script in versions 2.0.3

    As others have mentioned, the setup is slightly different in the new version but this post is still very close.

  3. Great article! Thanks a lot!

    It works with Aptana 2.0, as well, but two differences:

    1) I was not able to find the Window > Show Aptana View > Scripts view (at all), so I searched with full-text all files in my Eclipse folder and found the script. I copied and pasted it from that file.

    2) I didn’t find the Synchronization option in the project properties, because it’s renamed to File Transfer 🙂

  4. thank you,
    i have done all the above until where you say: “Now the script is complete, we need to setup a FTP account.”
    you say to select Window > Show Aptana > View > Sync Manager.

    But in my list there there are some views (in Aptana) but not the Sync Manager (or any similar).

    am i doing something wrong?
    all the above procedure was successfully done without any problems.

    thank you for your help

    1. This article was written in June 2009, so it was intended to work with Aptana 1.6, not the 2.0 edition that was released last week. This new revision probably does not work with this write-up.

  5. Thank you! Was browsing the aptana forums trying to get it to work, but this post is the one!

    You might consider adding that you also need to remove the text behind the command:
    // Add * Listener: commandService().addExecutionListener(this); [to the top of this file to enable it]

    Even though it’s quite obvious 😉

  6. Thanks for posting this, and for having it posted in the Aptana blog. It works as advertised. I think it works best when any synch connections/FTP connections are deleted – initially had issues getting the connection to show in Project > Properties > Synchronization connection list.

Leave a Reply to ZeekDaGeek Cancel reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s