Description
The getJdtSourcePath
task resolves the source folders of an eclipse project. The source folders can be resolved to ant's path-type or to a string property. The path can be resolved in a relative (to the given workspace) or absolute manner.
Arguments
The getJdtClassPath
task provides the following arguments:
Argument | Description | Required |
---|---|---|
workspaceDirectory | Absolute path of the workspace directory | Either 'workspaceDirectory' or 'workspaceId' has to be specified |
workspaceId | The identifier of a defined workspace (see <workspaceDefinition>) | Either 'workspaceDirectory' or 'workspaceId' has to be specified |
projectName | Name of the eclipse project | yes |
property | The name of the property that will hold the resolved path | either 'pathId' or 'property' has to be specified |
pathId | The reference id for the path that will be created | either 'pathId' or 'property' has to be specified |
pathSeparator | The system-dependent path-separator character. This character is used to separate filenames in a sequence of files. | no (default: On UNIX systems, this character is ':' ; on Microsoft Windows systems it is ';' ) |
dirSeparator | The system-dependent default name-separator character. | no (default: On UNIX systems the value of this field is '/' ; on Microsoft Windows systems it is '\' ) |
relative | Determines whether the result path should be resolved relative to the given workspace or absolute | no (default: false) |
allowMultipleFolders | Must set to true to allow multiple source folders. If allowMultipleFolders is false and the result contains multiple folders, an BuildException is thrown. | no (default: false) |
Example usage
Resolving the source path to an ant path
The following example shows how to resolve the source path of an eclipse JDT project to an ant path:
<ant4eclipse:getJdtSourcePath pathId="sourcepath" workspacedirectory="${workspace}" projectName="simple.java.project" />
Resolving the source path to an ant property
If you don't want to have the path as a path object but rather as a string Property, you can use the property parameter instead of the pathId argument. If you export the class path to a property, all its entries are separated by the operating systems default path separator (as defined in java.io.File.separator
). You can use the pathSeparator
attribute to explicitly specify a character that is used to separate the entries of the source path.
<ant4eclipse:getJdtSourcePath property="sourcepath" workspacedirectory="${workspace}" projectName="simple.java.project" />
Resolving relative pathes: The entries of the paths are absolute paths by default. You can use the boolean relative argument to receive a path that consists of pathentries that are relative to the project directory.
<ant4eclipse:getJdtSourcePath property="sourcepath" workspacedirectory="${workspace}" projectName="simple.java.project" relative="true" />
- Printer-friendly version
- Login to post comments