Skip to Content

<getJdtOutputPath>

Scope: JDT projects

Description

The getJdtOutputPath task resolves the output folders of an eclipse project. The output 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 getJdtOutputPath 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)
resolve Determines what kind of output folder should be resolved. If set to defaultFolder, the default output location will be returned. If set to forSourceFolder, the output folder for a specified source folder will be returned. If set to all, all output folders will be returned. no (default: defaultFolder)
sourceFolder If resolve is set to 'forSourceFolder', you must also specify a source folder. If this source folder has its own out folder, it will be returned. Otherwise the default output folder will be returned. no (yes, if 'resolve' is set to 'forSourceFolder')
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 default output folder to a path
The following example resolves the default output path of the project simple.java.project to a path with the id defaultoutpath:

<ant4eclipse:getJdtOutputPath workspacedirectory="${workspace}"
                              projectName="simple.java.project"
		              pathId="defaultoutpath" />

Resolving the default output folder to a 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:

<ant4eclipse:getJdtOutputPath workspacedirectory="${workspace}"
                              projectName="simple.java.project"
		              property="defaultoutpath" />

If you export the classpath 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 argument to explicitly specify a character that is used to separate the entries of the classpath.

Resolving a specific output folder to a property
The following example shows how to resolve the output folder for a specific source folder (e.g. 'src2'):

<ant4eclipse:getJdtOutputPath workspacedirectory="${workspace}"
                              projectName="simple.java.project"
		              property="outpath" 
                              resolve="forSourceFolder"
		              sourceFolder="src2" />