The following plugin provides functionality available through Pipeline-compatible steps. Read more about how to integrate steps into your Pipeline in the Steps section of the Pipeline Syntax page.

For a list of other such plugins, see the Pipeline Steps Reference page.


withGroovy: Execute Groovy script

  • input : Object (optional)

    Allows the Pipeline script to pass structured objects to the external Groovy script and receive structured return values. The values must be Serializable and may only refer to types defined in the Java Platform or Groovy language. If set to any non-null value, the external script may call the following methods:

    Returns the object passed in this parameter.
    Saves an object to be used as the return value of this step.

    (If your script passes -cp / -classpath, be sure to append/prepend $CLASSPATH / %CLASSPATH%.)

  • jdk : String (optional)
    Selects a version of Java to use when running Groovy. If you leave this at (Default) then groovy will use whatever java is in your system path, typically that which launched the agent (slave.jar).
  • tool : String (optional)
    Selects a version of Groovy to add to the system path. If you leave this at (Default) then groovy will just run the CLI (groovy.ui.GroovyMain) from the version of Groovy currently bundled in Jenkins. This is enough for simple scripts, but does not support specific command-line options of the full Groovy launcher.

Was this page helpful?

Please submit your feedback about this page through this quick form.

Alternatively, if you don't wish to complete the quick form, you can simply indicate if you found this page helpful?


See existing feedback here.