<launch>

Scope: Java Projects

Description

The launch task is a replacement for Ant's own java and junit-tasks that runs an application. Everything which is required to run an application (class name, program arguments, JVM arguments) is read from an Eclipse launch configuration file. This task always forks a new Java process which runs the application or test cases. The launch-task can also be used to execute a junit launch configuration.

Each time you run a java application or an junit test in Eclipse, a Launch configuration is created. You can edit existing launch configurations or create new ones from the run menu. A launch configuration knows the class or test to be executed and some additional configuration parameters such as program arguments, arguments passed to the VM and classpath settings. The launch configurations itself can be "shared" which means that they are written to an (xml-)file in your workspace that can be versioned in CVS as all other files. Shared launch configurations can be run from Ant using the launch-task from ant4eclipse.

The launch-task is similiar to Ant's own java task but reads all configurations (classpath, arguments etc) from a specified launch configuration file. Using this task, you can run your applications in exactly the same way you run them from Eclipse. This can be helpful if you're creating an automated build system that includes the execution of junit tests or other test applications.

Arguments

Argument Description Required
workspace Path to workspace yes
initialiseWorkspace Set to 'true' if your workspace contains projects which have project names that differ from the names of their project folders and the workspace doesn't contain a .metadata directory. no (default: false)
launchFile The launch configuration file that will be launched yes

Limitations

Currently the launch task does not support all configurations possible in eclipse:

Examples

The example below shows how to start an applicattion using the launch task.