Non-Ant project builders
When we worked through our project builder example, you may have
noticed that when we created our project builder Ant buildfile, we had a choice
of external tool type:
The Program option is essentially a catch-all, allowing you
to define an external tool for any executable file that is accessible on your
local or network file system. Suppose that instead of Ant, you prefer to use
your own shell scripts or Windows .bat files to jar up and deploy your Eclipse
projects. You would then create a Program external tool that specified where
and how to execute your script.
- Create a script that performs your preferred deployment steps.
- Select the project that you wish to build in one of the navigation views,
and choose Properties from the context menu.
- Select Builders, click New..., select Program and click
OK.
- The External Tools dialog appears, configured for Program type tools.
- Enter the location of your script, its working directory, and any required
arguments.
- In this case, the script is a Windows .bat file, but it could be a Linux
shell script, a Perl script or just about anything else that can be executed
on your system.
- The Refresh and Build Options tabs are identical to the tabs
we saw for Ant project builders. In particular, the Build Options tab
allows us to control what types of builds trigger our project builder buildfile.
- Apply the changes, and click OK.
- As with Ant project builders, we can control the ordering of this project
builder with respect to other project builders (such as the default Java Builder
for Java projects).
- Rebuild your project. This will trigger your script to execute. Any output
it generates will be sent to the Console view.
Ant is a popular tool for configuring and deploying projects. But if you prefer
some other tool, or prefer to do it yourself, you can set up a Program external
tool project builder. This allows you customize the deployment of your project
as you see fit, while keeping the convenience of automatically running your
script every time your project is built.