Resource
The resource element is used to introduce properties defined by a resource, or specific version of a resource, into the scope of a recipe. This allows properties defined in the resource repository on your pulse™ server to be accessed in the recipe. Using resources to define properties in this way has several advantages:
- the properties can be edited via the web interface
- the pulse™ file remains independent of these property values
- various commands, such as ant, make and maven, may search for standard properties defined by resources
- resources may be automatically discovered by your pulse™ server
- the same pulse™ file can be used by multiple pulse™ servers, by configuring the resources appropriately on each server
The properties are intorduced at the point that the resource reference is found. Thus the properties cannot be used by elements that come before the reference within the recipe.
Attributes
| Attribute |
Description |
Required? |
Default |
| name |
The name of the resource to introduce the properties from. |
Yes |
|
| required |
If true, failure to find the resource or version results in failure of the recipe (and thus the build). |
No |
true |
| version |
The version to introduce the properties from. |
No |
The default version for the resource. |
Child Elements
None.
Examples
First, suppose that your pulse™ server has the following resources defined:
| Resource |
Version |
Property Name |
Property Value |
| foo |
[default] |
foo.bin |
/usr/bin/foo |
| |
2.0 |
foo.bin |
/usr/bin/foo2 |
| bar |
[default] |
bar.bin |
/usr/bin/bar |
| |
|
bar.lib |
/usr/lib/libbar.so |
Then the outputs from the echo commands in this recipe:
<recipe name="example">
<resource name="foo" version="2.0"/>
<resource name="bar"/>
<echo name="e1" args="${foo.bin}"/>
<echo name="e2" args="${bar.bin}"/>
<echo name="e3" args="${bar.lib}"/>
</recipe>
Would be:
- /usr/bin/foo2
- /usr/bin/bar
- /usr/lib/libbar.so
respectively.