In a , IDE commands need to be mapped to targets in your Ant script. These mappings
are recorded in the project.xml file in your project folder.
Mappings are recorded in the project.xml file automatically in these cases:
When you specify a target for a command in the Build and Run Actions page of the
New Project wizard.
When you specify a target for a command in the Build and Run panel of the
Project Properties dialog box for a project.
When you create a mapping for a command after having chosen the command from
the Build menu or Run menu and having been prompted to create the mapping.
When you have had the IDE generate a target. (The IDE offers
to generate a target for the Debug Project and Compile File commands the first
time you choose these commands in a free-form project.)
You can also use the Project Properties dialog box to add a shortcut to any
Ant target to the project node's contextual menu. For example, if you have several
runnable classes that you need to run often, you can write targets to run these
classes and then run them using the links.
You map other commands, like those that run on individual files, by manually editing
project.xml.
Mapping Commands for a Project:
In the Projects window, right-click the project node and choose Properties.
Click Build and Run in the right panel of the Project Properties dialog
box.
For each command, choose an Ant target from the combo box. The combo box
contains each of the targets in your Ant script.
Use the Custom Menu Items list to add shortcuts to Ant targets to the project's
contextual menu.
If your Ant script uses an <import> target to import targets
from another Ant script, these targets only appear if the <import>
target specifies the full path to the secondary Ant script. If the <import>
target uses a property to reference the secondary Ant script, the targets
do not show up in the drop-down lists. In this case, you have to type the
name of the projects in the drop-down list for the command. You can also
map the IDE commands to the targets by editing the project.xml
file as described below.
Mapping IDE Commands in project.xml:
In the Files window, expand the node for your project folder and expand
the nbproject folder.
Double-click project.xml to open it in the Source Editor.
If you want to map an action to a target in a separate Ant script,
add the following before the <target> declaration:
<script>path_to_Ant_script</script>
You can map any of the following IDE actions:
debug. Debug project
build. Build project
run. Run project
test. Run tests for project
run.single. Run the currently selected file
debug.single. Debug the currently selected file
compile.single. Compile the currently selected file
test.single. Run the test file for the currently selected file
debug.test.single. Run the test file for the currently selected
file in the debugger
debug.fix. Run the Apply Code Changes command on the currently selected file
Note that actions that run on the currently selected files in the
IDE require additional configuration in project.xml. See the
article below for more information.
If you also want the command to appear in the project's contextual menu,
enter the following in <context-menu>:
<ide-action name="action_name"/>
For a full guide to configuring free-form projects, see: