One of the most exciting enhancements in ColdFusion 9 is actually not a ColdFusion 9 feature at all. Rather, it's the introduction of a dedicated ColdFusion IDE, ColdFusion Builder, available today as part of the ColdFusion 9 public beta. This new Eclipse based development environment has been built from the ground up with ColdFusion development in mind, and this post will help you get started quickly and easily.
ColdFusion Builder is a ColdFusion IDE built in Eclipse, the same platform which powers Flash Builder (and Flex Builder, previously). There are some important reasons for this:
- ColdFusion Builder and Flash Builder are designed to work together, and can greatly simplify the development of ColdFusion powered Flash and Flex applications.
- Eclipse is already popular with ColdFusion developers, thanks to community projects like CFEclipse.
- Eclipse is a proven platform with extensive support for all sorts of development, and all Eclipse plug-ins can be used with ColdFusion Builder. So, if you need something that we did not provide, a third-party plug-in may do the trick.
- Eclipse is supported on multiple platforms, including all of the platforms supported by ColdFusion itself.
- If you are unfamiliar with Eclipse, and are not already running an Eclipse installation (including Flex Builder and Flash Builder), then the ColdFusion Builder installer can install a complete Eclipse configuration for you, all ready to use.
- If you do have an existing Eclipse installation (including Flex Builder and Flash Builder), then the ColdFusion Builder installer can add ColdFusion support to that existing Eclipse. This is the preferred configuration if you are using Flash Builder.
ColdFusion Builder is an IDE, it is not ColdFusion itself. To use ColdFusion Builder you'll need access to a ColdFusion server (ideally ColdFusion 9). ColdFusion Builder can work with local or remote ColdFusion servers, but it is highly recommended that you use a local development server (ColdFusion Developer Edition is free, so no real downside, and lots of upside). You'll also need to know the ColdFusion Administrator and RDS login information for some ColdFusion Builder functionality to work properly.
When you first start up ColdFusion Builder, you may see a splash screen (well, one of several) which you can close. You'll then be presented with the IDE itself. Depending on what Eclipse plug-ins are installed, you may or may not be in "ColdFusion mode". Let me explain.
As noted above, Eclipse can be used for all sorts of development, Java, HTML, CSS, MXML, PHP, and much more. As each type of development needs different screens and panels in an IDE, Eclipse supports the defining sets of configurations called "Perspectives". A perspective is a specific screen setup, with windows and panels and toolbars all configured in a specific way. Switching perspectives is easy, and Eclipse can even auto-switch perspectives for you as you switch between projects and file types.
The Eclipse title bar should show you the perspective in use. In addition, there are buttons on the top right of the screen for switching between perspectives. If the title bar says "ColdFusion", and if you see tabs at the bottom for Servers, TailView, and more, and if you see RDS tabs in the panel on the right, then you are in the ColdFusion perspective. If not, open the Window menu, and select Open Perspective, Other, and then ColdFusion. Perspective selections are saved automatically in your Eclipse workspace, and so the next time you open ColdFusion Builder, the right perspective should be open and ready to use.
Before you can do anything useful with ColdFusion Builder, you need to tell it about the ColdFusion Server you'll be connecting to. You do this in the Servers tab at the bottom of the IDE. Here are the steps:
- Click on the Add Server button (the one with a server and a yellow + sign).
- Select ColdFusion as the server type.
- Enter a unique server name, this need not be the actual server name, it's what shows up in the server list so you know which server you are referring to. If you are using a local server you may want to just set it to "localhost".
- Enter the Host Name, this is the IP address or DNS name of your ColdFusion server, and it'll be "localhost" for a local development server.
- Enter the Web Server Port, this is usually 8500 for development servers using the integrated HTTP server, or 80 for servers connected to external HTTP servers.
- Enter the Context Root and Application Server Name only if using ColdFusion deployed on a J2EE server.
- Enter the RDS User Name and RDS Password. If you did not specify an RDS username then the default will be "admin".
- Click Next.
- Next, specify the Server Home (not the web root, this is the folder into which ColdFusion itself is installed, on Windows machines using a local development server this may be c:\ColdFusion9).
- Enter the Document Root (this is the web root), on Windows machines using a local development server this may be c:\ColdFusion9\wwwroot.
- Click Finish.
You'll now have a server listed in the Servers tab. You can click on the server to stop it, start it, access its Administrator, and more. These options are available via a toolbar and via right-click menu options.
Now that you have a server defined, the next step is to create a Project so that you may start development. Here are the steps:
- Select File, New, ColdFusion Project (or right-click in the Navigator panel on the left and select New, ColdFusion Project).
- Enter a unique Project Name (project names can have spaces in them).
- By default, Eclipse stores projects in a workspace folder, and these are typically not under the web root. For ColdFusion development, especially when working with a local development server, this is not optimal. So, uncheck the Use Default Location, and enter the path for your project in the Project Location field. The folder should be under the ColdFusion web root, and you may need to actually create a new folder.
- Then click Next.
- You'll then be asked for the server to use with this project. Select the server you just defined in the Servers drop down list box.
- Click Next.
- Then click Finish.
You now have a ColdFusion project ready to use. You can open and close projects in the Navigator panel (obviously, a project must be open to be able to use it).
Now let's create a quick application to make sure everything is working. Here are the steps:
- Open the new ColdFusion Project, if it is not already open.
- Make sure the project is selected (clicked on, otherwise you may create the file in another project).
- Create a new ColdFusion page by selecting File, New, CFM Page (or right-click in the Navigator panel on your project and select New, CFM Page).
- Enter a page Name, perhaps "index" (the .cfm extension is optional, and will be added automatically).
- Click Finish.
- The page will now be open for editing, enter some CFML code, perhaps the following:
Hello, it is #DateFormat(Now())#
- Save the page.
- Below the editor window you'll see browser tabs (the exact list of browsers present will vary based on your OS and the browsers installed). Click on any browser to run your code, and you'll see the generated output.
Assuming you made it this far, congratulations, you are now using ColdFusion Builder.
We've packed lots of features into ColdFusion Builder, but here are some you should be aware of:
- As you type code in the editor, notice that your code is automatically colored. If you are typing a tag and hit space and pause briefly, you'll be presented with a pop-up of available attributes or values.
- The editor also features lots of built-in intelligence. For example, if you are typing datasource="" you'll be presented with a list of available datasources, and when you type query="" in a <cfoutput> you'll be presented with a list of queries already defined. You'll discover lots of other shortcuts like this as you work.
- On the left edge of the editor, you'll see a - sign next to each tag. You can click this to collapse and expand blocks of code.
- Above the editor window you'll see a CFML toolbar. Mouse over each button to see what they do. The rightmost button serves two purposes, if a tag is selected it'll display the attributes for that tag, and if not it'll display a wizard to help you find the tag you want.
- In the panel below the editor you'll see a tab named TailView. This useful tab can show you changes in server log files as they occur. By default no log files will be listed, but at a minimum you'll want to add application.log, server.log, and exception.log (you can add others, too). To add these click on the Add Log button (it has a picture of a document with a plus in a green circle) and select the log files to add. ColdFusion log files are in a folder named "logs" under the ColdFusion root.
- The panel on the right of the editor contains the RDS Dataview tab. Use this to browse datasources, run data wizards, and more.
- The same panel contains the Outline tab which shows you the outline of your code and lets you easily jump to specific code blocks by clicking on tags.
- All panels can be moved, as can panel tabs (which can be moved from panel to panel, for example, I find that the Services Browser tab a better fit for the panel on the right than the panel at the bottom).
- ColdFusion Builder includes an FTP plug-in that you can use to deploy projects via FTP.
- Earlier I mentioned ColdFusion Builder extensions. These are distributed as ZIP files that can easily be installed into ColdFusion Builder (visit RIAForge to access a growing list of extensions, including Ray Camden's invaluable QueryParam Scanner). To install extensions, simply download the ZIP file, then open the Window menu and select Preferences, ColdFusion, Extensions, click Install, and then follow the prompts.
I've only touched the ColdFusion Builder surface here, but as you can see, this new tool can already simplify your ColdFusion development, and we're just getting started. ColdFusion Builder can be used with earlier versions of ColdFusion, but it ideally used with ColdFusion 9.