codepro.getClasspath
Retrieves the class path of a project and place the results into the
specified Ant property.
Valid attributes include:
- projectName = "projectName" (optional - defaults to project
containing basedir)
The name of the project from which the classpath will be
extracted. If omitted, then the project name is set to the name of
the project that contains the directory specified by the Ant project's
basedir property.
- propertyName = "antProperty" (optional - defaults to "eclipse.project.projectName.classpath")
The name of the any property into which the classpath is
placed
- resolve = true/false/search (optional - default true)
If "true", then each classpath entry is resolved before the
result is placed into the specified Ant property. If "search" is
specified, then for each classpath entry that specifies a *.jar file that
does not exist, a search is made for a identically named jar file in a
similarly named directory where only the plugin version number is
different. For example, if the original classpath entry was "..../plugins/some.identifier_1.0.0/code.jar"
but did not exist, then if a path such as "..../plugins/some.identifier_2.3.0/code.jar"
existed, then it would be substituted for the original classpath entry.
- binPath = "bin10" (optional)
If specified, then every place where the classpath resolves
to a project output directory (e.g." /MyProject/bin") then the specified
directory in the same project will be substituted (e.g. "/MyProject/bin"
becomes "/MyProject/bin10") If the specified directory in
the project does not exist and the Ant property named "codepro.getClasspath.binPathRoot"
is defined, then it will be prepended to the project output directory (e.g.if
"codepro.getClasspath.binPathRoot" is "c:/foo" then "/MyProject/bin"
becomes "c:/foo/MyProject/bin10")
One classpath variable can be substituted for another using a subelement,
where the path can either be absolute, or the name of a different classpath
variable.
- <classpath_variable name="classpathVarName" path="newValueForClasspathVar"/>
Classpath entries can be added:
- <classpath_add>
<classpath_entry path="newClasspathEntry"/>
</classpath_add>
modified:
- <classpath_modify path="oldClasspathEntry">
<classpath_entry path="newClasspathEntry"/>
</classpath_modify>
or removed:
- <classpath_remove path="oldClasspathEntry"/>
Classpath modifications can be grouped for use in several different
codepro.getClasspath expressions
using the classpath_modifications datatype:
- <classpath_modifications id="MyID">
<classpath_variable name="classpathVarName" path="newValueForClasspathVar"/>
<classpath_add>
<classpath_entry path="newClasspathEntry"/>
</classpath_add>
<classpath_remove path="oldClasspathEntry"/>
</classpath_modifications>
Classpath variable substitutions and classpath modification is performed
before the classpath is resolved.
Example #1:
<codepro.getClasspath projectName="MyProject" resolved="false" propertyName="MyClasspath">
<classpath_variable name="ECLIPSE20_HOME" path="ECLIPSE10_HOME"/>
<classpath_variable name="MY_CLASSPATH_VAR" path="C:\Dev\Foo"/>
<classpath_add>
<classpath_entry path="ECLIPSE10_HOME/plugins/my.id/my.code.jar"/>
</classpath_add>
</codepro.getClasspath>
Example #2:
<classpath_modifications refid="MyID">
<classpath_variable name="ECLIPSE20_HOME" path="ECLIPSE10_HOME"/>
<classpath_variable name="MY_CLASSPATH_VAR" path="C:\Dev\Foo"/>
<classpath_add>
<classpath_entry path="ECLIPSE10_HOME/plugins/my.id/my.code.jar"/>
</classpath_add>
</classpath_modifications>
<codepro.getClasspath projectName="MyProject" resolved="false" propertyName="MyClasspath">
<classpath_modifications refid="MyID"/>
</codepro.getClasspath>
Both of these examples produce an identical result. In each of
these, the classpath for MyProject is retrieved, modified
(but not resolved), and then placed into the Ant property with the name "MyClasspath"
|