__FILE__ variable

21 views
Skip to first unread message

Philippe Jean

unread,
Jun 17, 2016, 9:42:37 AM6/17/16
to job-dsl-plugin
Hi,

I'm trying to use __FILE__ variable in order to load a file which is in the same directory but I get :
No such property: __FILE__ for class: script

when I try to do a simple :
println "Script: ${ __FILE__}"

Could you please help me what I'm doing wrong ?

Thanks

Daniel Spilker

unread,
Jun 17, 2016, 9:56:35 AM6/17/16
to job-dsl...@googlegroups.com
Which version do you use? __FILE__ has been added in 1.45.

Daniel

--
You received this message because you are subscribed to the Google Groups "job-dsl-plugin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to job-dsl-plugi...@googlegroups.com.
To post to this group, send email to job-dsl...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/job-dsl-plugin/3ed88a9c-bd3f-4af6-8f84-b184ac65213b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Philippe Jean

unread,
Jun 17, 2016, 10:06:03 AM6/17/16
to job-dsl-plugin
I used the latest version and try to test it locally with : ./gradlew debugXml "-Dpattern=jobs/*.groovy"

Daniel Spilker

unread,
Jun 17, 2016, 10:18:18 AM6/17/16
to job-dsl...@googlegroups.com
__FILE__ is only available when the DSLScriptLoader knows the file location. But XmlOutputRunner calls the DSLScriptLoader with the script content instead of the script file itself, so __FILE__ is not available.

Daniel

Philippe Jean

unread,
Jun 20, 2016, 9:22:53 AM6/20/16
to job-dsl-plugin
OK, thank you for the clarification.
Reply all
Reply to author
Forward
0 new messages