I'm writing a Jenkins Build Flow Plugin script and would like to access the filename from within the script itself (so that if the file is renamed, the script content won't have to change). How can this be done?
Asked
Active
Viewed 466 times
0
-
Does `getClass().protectionDomain.codeSource.location.path` work? – tim_yates Jan 25 '15 at 18:48
-
@tim_yates, nope. It returns `/groovy/shell`. – Noel Yap Jan 26 '15 at 18:37
1 Answers
0
The following works when using the Jenkins Build Flow Plugin:
build.dslFile
It's a private field, though, so there's no guarantee it will work with all versions of the plugin.

Noel Yap
- 18,822
- 21
- 92
- 144