def request = libraryResource 'com/mycorp/pipeline/somelib/request.json' 

The file is loaded as a string, suitable for passing to certain APIs or saving to a workspace using writeFile . 

It is advisable to use an unique package structure so you do not accidentally conflict with another library. 

## Pretesting library changes 

If you notice a mistake in a build using an untrusted library, simply click the Replay  link to try editing one or more of its source files, and see if the resulting build behaves as expected. Once you are satisfied with the result, follow the diff link from the build’s status page, and apply the diff to the library repository and commit. 

(Even if the version requested for the library was a branch, rather than a fixed version like a tag, replayed builds will use the exact same revision as the original build: library sources will not be checked out again.) 

Replay  is not currently supported for trusted libraries. Modifying resource files is also not currently supported during Replay . 

## Defining Declarative Pipelines 

Starting with Declarative 1.2, released in late September, 2017, you can define Declarative Pipelines in your shared libraries as well. Here’s an example, which will execute a different Declarative Pipeline depending on whether the build number is odd or even: 

