Package hudson.cli

Class GroovyCommand

java.lang.Object
hudson.cli.CLICommand
hudson.cli.GroovyCommand
All Implemented Interfaces:
ExtensionPoint, Cloneable

@Extension public class GroovyCommand extends CLICommand
Executes the specified groovy script.
Author:
Kohsuke Kawaguchi
  • Field Details

    • script

      public String script
    • remaining

      public List<String> remaining
      Remaining arguments.
  • Constructor Details

    • GroovyCommand

      public GroovyCommand()
  • Method Details

    • getShortDescription

      public String getShortDescription()
      Description copied from class: CLICommand
      Gets the quick summary of what this command does. Used by the help command to generate the list of commands.
      Specified by:
      getShortDescription in class CLICommand
    • run

      protected int run() throws Exception
      Description copied from class: CLICommand
      Executes the command, and return the exit code.

      This is an internal contract between CLICommand and its subtype. To execute CLI method from outside, use CLICommand.main(List, Locale, InputStream, PrintStream, PrintStream)

      Specified by:
      run in class CLICommand
      Returns:
      0 to indicate a success, otherwise a custom error code. Error codes 1-15 shouldn;t be used in CLICommand.run() as a custom error code.
      Throws:
      Exception - If a further unspecified exception is thrown; means: Unknown and/or unexpected issue occurred
      org.kohsuke.args4j.CmdLineException - If a wrong parameter specified, input value can't be decoded etc.
      IllegalArgumentException - If the execution can't continue due to wrong input parameter (job doesn't exist etc.)
      IllegalStateException - If the execution can't continue due to an incorrect state of Jenkins, job, build etc.
      AbortException - If the execution can't continue due to an other (rare, but foreseeable) issue
      org.springframework.security.access.AccessDeniedException - If the caller doesn't have sufficient rights for requested action
      org.springframework.security.authentication.BadCredentialsException - If bad credentials were provided to CLI