<getOutputpath>

Scope: Java Projects

Description

The getOutputpath 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

Note: You can specify either the path to the project (using the project argument) or you can specify the path to the workspace (workspace argument) and the name of the project (projectName argument).

Argument Description Required
project Path to the project for which the output path should be build either the project or the combination of workspace and projectName has to be specified
workspace Path to the workspace containing the projects
projectName Name of the project inside of the workspace for which the output path should be build
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)
pathId The reference id for the path that will be created either the pathId or the property has to be specified
property The name of the property that will hold the resolved path either the pathId or the property has to be specified
relative Determines whether the resolved path should contain relative paths (to the given workspace) or absolute paths no (default: false)
pathSeparator The pathSeparator string is used to separate the filenames in the property no (default: on UNIX systems, this character is ':'; on Microsoft Windows systems it is ';'.)
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 output folders. If allowMultipleFolders is false and the result contains multiple folders, an BuildException is thrown. no (default: false)
variablesRef The ID of an ant property set. This property set will be used to resolve Eclipse variables. This allows to prefer a specific set of properties rather than using the ant properties in general. no

Examples

You can get a path from an eclipse project using the getEclipseClasspath-, the getSourcepath- or the getOutputpath-Task. These tasks read and parse the .classpath file from the underlying eclipse project and constructs an Ant path object. The tasks require the location of an eclipse workspace (to be more precise: a location where eclipse projects reside, it's not neccessary to use a "real" workspace) and the name of a project. Alternatively you can specify the location of the project. Furthermore, you have to specify the name of the Reference which you'll use later in your build to access the path object.

Example:

The following example shows how to use the getOutputpath task:

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 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.

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.

See also: getSourcepath