Scripts libraries

A script module library is a term given to a script module who’s resources (Groovy, XSLT etc) are used by one or more other script modules.

Script module libraries help reduce code duplication and enable collections of critical resources to be controlled together.

Creation of a script module library is the same as the creation of any other script module. However, one notable difference is that the main script will never be executed so may be left blank.


A script module library will typically consist of a number of Groovy class scripts.

If the class requires access to the Platform 6 DSL then this must be accessed via a reference to the main script (passed as an argument to the class constructor).

class MyClass {

    def context

    MyClass( def context ){

        this.context = context    

    void showAppId() {

        println context.configuration.get('applicationid')

Other resources such as XSLT, HTML and TEXT type resources can also be present in a script module library.

Including Script Module Libraries

To use a script module library it must be included to be accessible. This is done using one or more @include tags as part of a GroovyDoc style comment at the beginning of the script.

Groovy Documentation Comments

These have the same structure as Javadoc comments: a documentation comment consists of the characters between /** and */ that end it. Leading asterisks are allowed on each line.

The below is an example of a script including two script module libraries.

 * Sample Groovy script using a standard library of classes
 * and a library of general helpers
 * @include PIDXStandard
 * @include Invoice Helpers


It is not possible to include a script module library that does not have the same application key as the including script.

When the main script is compiled, all the Groovy classes from the included script modules are also compiled and added to the classpath of the current main script. In addition, all none Groovy resources are added to the current script module resources and can be accessed via the standard DSL:


Resource Names

The name of a resource is used as its key when accessing it at runtime.

When including a script module library be aware that resources with the same names will be in conflict and only last one processed will be stored for runtime access!

As a convention, it is recommended that all resources in script module libraries are prefixed with a unique namespace modifier (the name of the script module library for example).

Groovy caching

Compiled Groovy classes from script module libraries are cached with the script that uses them to give the best possible execution performance.

However, this means that in order to force a script to recompile it’s library of Groovy classes (if the library source changes for example) it must be re-saved.