<launch>
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:
- Variables are not supported: The usage of Eclipse variables is not support
- Running single test methods: While it is possible in Eclipse to create launch configurations that run single test methods, it is not possible to launch those configurations in ant4eclipse
- Running all test cases of a folder or project: Eclipse
supports the recursive execution of all testcases in a project,
in a folder or in a package. This does not work in ant4eclipse.
With the
launch-task it's only possible to launch all tests from the source folder of a project. The best and safest way to execute a set of tests is to write aTestAllclass that create a testsuite containng all JUnit tests. Then create a launch configuration for this class and execute this configuration with ant4eclipse.
Examples
The example below shows how to start an applicattion using
the launch task.