Artifact
The artifact element is used to specify a file to capture as an artifact. Files captured in this way will be preserved and made available with the build result, and may be post-processed in order to find features and/or test results. Typical artifacts include binaries (executables, jars), packages (ZIPs, RPMs) and reports (test, coverage).
When you specify that an artifact should be captured and that artifact is not found, the corresponding command will fail. This ensures that unexpected changes in the artifacts produced by the command will be detected. You can, however, override this behaviour using the fail-if-not-present attribute.
 | Escaping
Note that to use backslash (\) as a path separator, you must escape it with another backslash. Thus to capture the file example\path\to\file, your file attribute would need to be example\\path\\to\\file. For this reason, it is usually more convenient to use the forward slash (/) as a file separator, even on Windows. |
Attributes
| Attribute |
Description |
Required? |
Default |
| fail-if-not-present |
If true, if the artifact is not found, the corresponding command (and thus build) will fail. |
No |
true |
| ignore-stale |
If true, files with modified times before the start of the recipe execution will be ignored. |
No |
false |
| name |
The name of the artifact, used in the web interface. |
Yes |
|
| file |
The path of the file to capture, relative to the base directory for the build. This attribute supports Apache Ant style patterns (see Filtering Captured Files for details of the pattern syntax) |
Yes |
|
| type |
The MIME type of the file to capture. This will be provided to the browser when the artifact is downloaded. |
No |
Guessed from file extension and content |
Child Elements
| Element |
Description |
Number |
| process |
Specifies a post-processor to apply to the artifact after it is captured. |
0 or more |
Examples
Capture an RPM package produced by the build:
<command name="build all">
<make targets="all package"/>
<artifact name="rpm package" file="packages/my-package.rpm"/>
</command>
Capture a versioned zip package produced by the build:
<command name="build all">
<make targets="all package"/>
<artifact name="zip package" file="packages/my-package-*.zip"/>
</command>
Capture and post-process a JUnit test report:
<junit.pp name="junit.pp"/>
<recipe name="default">
<command name="build">
<ant targets="clean all"/>
<artifact name="junit report" file="reports/TESTS-TestSuites.xml">
<process processor="${junit.pp}"/>
</artifact>
</command>
</recipe>