If you’re currently not using Eclipse as your development tool of choice, you certainly should be! Eclipse is an open source community whose projects are focused on building an open development platform comprised of extensible frameworks, tools and runtimes for building, deploying and managing software across the lifecycle.

Eclipse started out as a Java IDE and has continually grown from there. Plugins now include, amongst a plethora of others, the venerable Aptana, CFEclipse, SQL Explorer, Subclipse and, more recently, the Adobe-developed Flex Builder and ColdFusion-equivalent codenamed Bolt.

Apache Ant is a software tool for automating software build processes. It is implemented using the Java language, requires the Java platform, and was originally developed to automate the build of Java projects. However, since Ant was created as a simple, platform-independent tool, it can really be used to automate the build of anything you choose.

Ant uses XML to describe the build process and its dependencies, using a file commonly called build.xml. Using this file, Ant makes it trivial to integrate unit testing frameworks with the build process and has made it easy for web developers to adopt test-driven development, and even Extreme Programming.

Fortunately for us, if you download and run Eclipse, you already have Ant installed and so do not have any complex configuration to concern yourself with; well, at least initially.

Setting Up Eclipse

For the most part, Eclipse has all you need to get up and running with Ant pre-installed. However, most projects will include a release target which uses FTP to upload the files to a live server. The FTP ant task requires some extra libraries (.jar files):

commons-net-*.jar
jakarta-oro-*.jar

(The library files can be downloaded from here).

Copy the files into the ant lib folder of your Eclipse install. The folder is commonly located here:

C:\Program Files\Eclipse\plugins\org.apache.ant_*\lib

(The asterix * refers to the Ant version).

Next, go to Window > Preferences and select Ant > Runtime. In the Classpath tab, select Ant Home Entries, click Add External JARs… and select the 2 files you copied to the ant lib folder.

A Typical Ant Project Setup

A project with ant build scripts should have the following within the repository:

  • build.xml (the actual ant build script)
  • build.properties.template (a template for individual build.properties files)
  • an optional top level lib folder (containing jar files for external ant tasks)

Examples of the build.xml and build.properties.template files can be downloaded from here.

Create Your Own build.properties File

Make a copy of the build.properties.template file (name it build.properties) and set the values to fit your local setup (in most cases, the only property you may want to change is deploy.dir.local which is the path to the site on your local machine).

This file should never be committed to the repository (the repository should be set to ignore it anyway).

Basic Build Tasks

The build file should have a deploy.local task. This task builds the project and copies it to your local webserver (the path to the web server folder will be defined in the build.properties file).

Most projects should also have a deploy.dev task to copy the latest work to the dev server so that other people can view it.

Setting Up an Automatic Build

To make things easy, you can set deploy.local to run every time you save a file. This is called an automatic build.

The process for setting up automatic build is quite convoluted. I’m not sure why but this is the best way I’ve found to make it work.

Step 1: Add the build file to your ant view

Click the add button and select the build.xml file from the project. You can also drag the build.xml file onto the ant view (To add the ant view to your perpective, go to Window > Show View > Other…)

Step 2: Run as Ant Build

In your ant view, right click the newly added build file and select Run As > Ant Build… In the dialog window, select the ‘Hide internal targets not selected for execution’ option in the Targets tab. You can rename the builder in the box at the top of the window if you wish (I usually remove the trailing ‘build.xml’. Click Apply and Close.

Step 3: Setup automatic build

Right click on the project, select Properties, then Builders. Click Import… and select the builder you created in step 2. Go to the Targets tab select clean for ‘After a clean’ and deploy.local for ‘Auto build’. Apply and close.

Step 4: Enable Auto Build

Go to Project > Build Automatically

Acknowledgment: Thanks should go to Martin Laine for his help and guidance which resulted in this article.

CFEclipse is a community project that builds on the open-source Eclipse framework to deliver expert, code-centric developers a new option for ColdFusion development. CFEclipse provides Eclipse with an outline view, a CFC (ColdFusion component) view, code completion (code hinting), syntax highlighting text editors for CFML and CFC files, and many more ColdFusion-specific features.

Eclipse can be downloaded from http://www.eclipse.org and CFEclipse from http://www.cfeclipse.org.

One thing CFEclipse does not have is WYSIWYG ability. Its complete focus is on writing ColdFusion code (so-called hand coding) and building tools that help you write code. If you do a lot of visual or page-layout development, for instance, if you rely heavily on drag-and-drop tools, wizards, or the Design view in Macromedia Dreamweaver, CFEclipse may not be the tool for you.

However, to make your life easier when coding, below is a list of keyboard shortcuts that make common tasks available in a couple of keystrokes:

Keys Description
Key Shortcuts
Ctrl+Shift+L Key Assist (dialog windows)
Alt+Shift+Q Show View
Comments
Ctrl+Shift+M ColdFusion Comment <!--- --->
Ctrl+Shift+C Context sensitive comment
Surround Selection
Ctrl+3 Pound/hash marks ##
Ctrl+’ Single quotes ''
Ctrl+Shift+” Double quotes ""
Ctrl+Shift+O <cfoutput></cfoutput>
Ctrl+Shift+D <cfdump var="##">
Ctrl+Shift+R <cfscript></cfscript>
Insert
Ctrl+Enter <br/>
Ctrl+Shift+Space &nbsp;
Ctrl+Shift+P <p></p>
Ctrl+I <em></em>
Ctrl+B <strong></strong>
Edit
Alt+Up or Alt+Down arrow Moves the current line up or down
Ctrl+Alt+Up or Ctrl+Alt+Down Duplicates line above/below current
Shift+Enter Insert line below current line
Ctrl+Shift+Enter Insert line above current line
Ctrl+D Deletes current line
Ctrl+Delete Delete next word
Ctrl+Backspace Delete previous word
Ctrl+Shift+Delete Delete to end of line
Function Keys
F1 Tag/function reference at http://www.cfdocs.org
F5 Refresh browser view
F8 Scribble pad
Ctrl+F3 Surround with ##
Ctrl+F5 Reload dictionaries
Ctrl+F6 Switch editor
Ctrl+F7 Switch view
Ctrl+F8 Switch perspective
Search / Find
Ctrl+H Search
Ctrl+F Find
Ctrl+K Find next
Ctrl+Shift+K Find previous
Browsing
F12 View current page in browser
Shift+F12 View current page in secondary browser
F5 Refresh internal browser
Shift+F5 View current page in internal browser
Ctrl+Shift+F5 View project root in internal browser
Windows / Navigation
Ctrl+Shift+R Opens the Open Resource (while in Navigator)
Ctrl+E List open files, then start typing the name
Ctrl+F6 Tab back through open files
Ctrl+Shift+F6 Tab forwards through open files
Ctrl+M Maximise/Minimse Current window
Miscellaneous
Tab Indent code
Shift+Tab Un-indent code
Ctrl+L Goto line number
Ctrl+Q Repeat last tag
Ctrl+Shift+Z Insert Color

  • ColdFusion Studio, the original ColdFusion IDE, based on Allaire’s HomeSite and subsequently replaced by Dreamweaver and Homesite+ after the Macromedia takeover.
  • Macromedia Homesite
  • Macromedia Dreamweaver, WYSIWYG & code editor.
  • CFEclipse, a ColdFusion plugin for the Eclipse IDE.