External Tools

External tools allow you to configure and run programs, batch files, Ant buildfiles, and others using the Workbench. You can save these external tool configurations and run them at a later time.

Output from external tools is displayed in the Console view.

You can add external tools as part of the build process for a project. These external tools will run in the specified order every time a project is built.

The following variables are available when you configure an external tool. These variables are automatically expanded each time the external tool is run.

Variable Name

Description

${workspace_loc} The absolute path on the system's hard drive to Eclipse's workspace directory
${workspace_loc:<resource path>} The absolute path on the system's hard drive to the specified resource. The <resource path> is the full path of the resource relative to the workspace root. For example ${workspace_loc:/MyProject/MyFile.txt}. Note that the expanded result of this variable is not the same as ${workspace_loc}/MyProject/MyFile.txt if the project's contents directory for MyProject is outside the workspace directory.
${project_loc} The absolute path on the system's hard drive to the currently selected resource's project or to the project being built if the external tool is run as part of a build.
${project_loc:<resource path>} The absolute path on the system's hard drive to the specified resource's project. The <resource path> is the full path of the resource relative to the workspace root. For example ${workspace_loc:/MyProject/MyFile.txt}. Note that the expanded result of this variable is not the same as ${workspace_loc}/MyProject if the project's contents directory for MyProject is outside the workspace directory.
${container_loc} The absolute path on the system's hard drive to the currently selected resource's parent (either a folder or project).
${container_loc:<resource path>} The absolute path on the system's hard drive to the specified resource's parent (either a folder or project). The <resource path> is the full path of the resource relative to the workspace root. For example:${workspace_loc:/MyProject/MyFolder/MyFile.txt}. Note that the expanded result of this variable is not the same as ${workspace_loc}/MyProject/MyFolder if the project's contents directory for MyProject is outside the workspace directory.
${resource_loc} The absolute path on the system's hard drive to the currently selected resource.
${resource_loc:<resource path>} The absolute path on the system's hard drive to the specified resource. The <resource path> is the full path of the resource relative to the workspace root. For example ${workspace_loc:/MyProject/MyFile.txt}. Note that the expanded result of this variable is not the same as ${workspace_loc}/MyProject/MyFile.txt if the project's contents directory for MyProject is outside the workspace directory.
${project_path} The full path, relative to the workspace root, of the currently selected resource's project or of the project being built if the external tool is run as part of a build.
${container_path} The full path, relative to the workspace root, of the currently selected resource's parent (either a folder or project).
${resource_path} The full path, relative to the workspace root, of the currently selected resource.
${project_name} The name of the currently selected resource's project or of the project being built if the external tool is run as part of a build.
${container_name} The name of the currently selected resource's parent (either a folder or project).
${resource_name} The name of the currently selected resource.
${build_type} The kind of build when the external tool is run as part of a build. The value can be one of "full", "incremental", or "auto". If the external tool is run outside of a build, the value is then "none".

Lets assume your Eclipse workspace directory is c:\eclipse\workspace and you have two projects, MyProject1 and MyProject2. The first project, MyProject1, is located inside the workspace directory, the second project, MyProject2, is located outside the workspace directory at c:\projects\MyProject2. Lets look at how the variable examples below will be expanded when an external tool is run, if the resource /MyProject2/MyFolder/MyFile.txt is selected.

Variable Example

Expanded Results

${workspace_loc} c:\eclipse\workspace
${workspace_loc:/MyProject1/MyFile.txt} c:\eclipse\workspace\MyProject\MyFile.txt
${workspace_loc:/MyProject2/MyFile.txt} c:\projects\MyProject2\MyFile.txt
${project_loc} c:\projects\MyProject2
${project_loc:/MyProject1/MyFile.txt} c:\eclipse\workspace\MyProject
${container_loc} c:\projects\MyProject2\MyFolder
${resource_loc} c:\projects\MyProject2\MyFile.txt
${project_path} /MyProject2
${container_path} /MyProject2/MyFolder
${resource_path} /MyProject2/MyFolder/MyFile.txt
${project_name} MyProject2
${container_name} MyFolder
${resource_name} MyFile.txt
${build_type} none
Ant support
Builds External Tools preferences
External Tools and Ant icons
Console view Running external tools
Running Ant buildfiles