Load Shared Scriptlet Into scriptletContext

I have a use case for introducing a common shared scriptlet which could be used as a helper library for other developers which contain common functions we use for scriptlets. 
I'm looking for something like this:
Does something like that exist?
Is there any way to load multiple scriptlets into one? I'm pretty sure I could achieve this also by loading a systemProperty holding the script then using eval but that feels abit messy. 


  • Verified Answer


    Scriptlets are not loaded into the context by default as other configuration items. As such there is no method to load them into context, therefore the only method would be to load the scriptlet content into system properties and use eval. 

    Keep in mind that if you go for this aproach  the scriptlets will increase the size of the context of all executions (since they are available for all executions by default) and you may run into memory issues during execution, depending on the size of the scriptlets.

    You can have only one  script loaded as shared script. 

    Instead of loading all scripts into one and then adding more logic  to figgure out which one is needed, why not create a content pack which just contains  these scriptlets and they can mix and match the scriptlets from that content pack as needed?



  • Thanks for quick response Vlad, not convinced a library of different scriptlets would work in out scenario because there could be plenty of usecases to apply multiple scriptlets to single operation.  Anyway will explore the eval approach alittle more. Alex