<getReferencedProjects>
Description
The getReferencedProjects task gets a list of projects that are directly or indirectly referenced by a specified project. All referenced projects have to exist in the workspace, otherwise the task will fail.
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 | |
| source | Defines where the referenced projects should be read from: can take the value classpath (default),
to read referenced projects from the .classpath file or project to read projects
from the .project file. |
no (defaults to classpath) |
| property | Name on an Ant Property that will contain
the list with dependent projects |
yes |
| exportedOnly | List only those projects that are exported (equivalent to a compile-time classpath) | no (defaults to false, i.e. list all projects even if they're not exported) |
| separator | Separator that separates the project names in the result property | no (defaults to ",") |
| recursive | When source set to project this property can be used to
specify that all projects should be listed, i.e. including those that are only
indirect referenced by this project. When set to false only those projects
directly referenced by this project are listed |
optional (default to true) |
| unavailableProjects | When the project refers to other non-existing projects this would
normally lead to an exception due to the missing project location. When this property
is set this won't happen. The projects that could not be resolved will be added to
this property. The property will only be set in the case that at least one referenced
project could not be found. Of course these projects will not be followed when the
attribute recursive is set to true. |
no |
| 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 |
You can get a list of project (names) that a project depends on
using the getReferencedProjects-Task. This tasks sets
an ant Property containing the name of all referenced
projects in the order they would occure on the classpath (source="classpath") or
as they are listed in the .project file.
Examples
Imagine you have four projects:
| Project | References | Exported |
|---|---|---|
| project4 | project3 | no |
| Project3 | project2 | yes |
| Project2 | project1 | no |
| Project1 |
Using the following code would return a list containing
project1,project2,project3,project4 as property name
dependentProjects:
If you only like to see the exported projects (comparable to a
compile-time classpath) use the following code that returns a list
containing project2,project3,project4:
See also: getBuildOrder