To begin, add the function-groovy
dependency (instead of the provider-specific dependency) which provides additional AST transformations that make writing functions simpler.
You can now create your function as a Groovy script, under . You will set your project’s main class property to this function (instead of FunctionApplication
as in Java/Kotlin). For example:
HelloGroovyFunction.groovy
The function you define should follow the following rules:
In order to make use of dependency injection in your Groovy function, use the annotation transform in addition to the @Inject
annotation.