Package groovy.grape

# Class Grape

java.lang.Object
groovy.grape.Grape

public class Grape extends Object
Facade to GrapeEngine.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `AUTO_DOWNLOAD_SETTING`
  Argument key for the auto-download setting.
  `static final String`
  `DISABLE_CHECKSUMS_SETTING`
  Argument key for the disable-checksums setting.
  `protected static GrapeEngine`
  `instance`
  Lazily created grape engine instance.
  `static final String`
  `SYSTEM_PROPERTIES_SETTING`
  Argument key for additional system properties.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Grape()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `addResolver(Map<String,Object> args)`
  Adds a resolver to the shared grape engine.
  `static Map<String,Map<String,List<String>>>`
  `enumerateGrapes()`
  Enumerates locally available grapes.
  `static boolean`
  `getDisableChecksums()`
  Global flag to ignore checksums.
  `static boolean`
  `getEnableAutoDownload()`
  This is a static access auto download enabler.
  `static boolean`
  `getEnableGrapes()`
  This is a static access kill-switch.
  `static GrapeEngine`
  `getInstance()`
  Returns the shared grape engine instance.
  `static void`
  `grab(String endorsed)`
  Grabs a dependency expressed using the endorsed module shorthand.
  `static void`
  `grab(Map<String,Object> dependency)`
  Grabs a single dependency.
  `static void`
  `grab(Map<String,Object> args, Map... dependencies)`
  Grabs one or more dependencies using the supplied arguments.
  `static Map[]`
  `listDependencies(ClassLoader cl)`
  Lists dependencies associated with the supplied class loader.
  `static URI[]`
  `resolve(Map<String,Object> args, List depsInfo, Map... dependencies)`
  Resolves dependency coordinates to URIs while optionally collecting dependency information.
  `static URI[]`
  `resolve(Map<String,Object> args, Map... dependencies)`
  Resolves dependency coordinates to URIs.
  `static void`
  `setDisableChecksums(boolean disableChecksums)`
  Set global flag to ignore checksums.
  `static void`
  `setEnableAutoDownload(boolean enableAutoDownload)`
  This is a static access auto download enabler.
  `static void`
  `setEnableGrapes(boolean enableGrapes)`
  This is a static access kill-switch.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### AUTO_DOWNLOAD_SETTING

    public static final String AUTO_DOWNLOAD_SETTING
    Argument key for the auto-download setting.
    See Also:
      - Constant Field Values

  - ### DISABLE_CHECKSUMS_SETTING

    public static final String DISABLE_CHECKSUMS_SETTING
    Argument key for the disable-checksums setting.
    See Also:
      - Constant Field Values

  - ### SYSTEM_PROPERTIES_SETTING

    public static final String SYSTEM_PROPERTIES_SETTING
    Argument key for additional system properties.
    See Also:
      - Constant Field Values

  - ### instance

    protected static GrapeEngine instance
    Lazily created grape engine instance.

- ## Constructor Details

  - ### Grape

    public Grape()

- ## Method Details

  - ### getEnableGrapes

    public static boolean getEnableGrapes()
    This is a static access kill-switch. All the static shortcut methods in this class will be disabled if this property is set to false. By default, it is set to true.

  - ### setEnableGrapes

    public static void setEnableGrapes(boolean enableGrapes)
    This is a static access kill-switch. All the static shortcut methods in this class will be disabled if this property is set to false. By default, it is set to true.

  - ### getEnableAutoDownload

    public static boolean getEnableAutoDownload()
    This is a static access auto download enabler. It will set the 'autoDownload' value to the passed in arguments map if not already set. If 'autoDownload' is set the value will not be adjusted.

    This applies to the grab and resolve calls.

    If it is set to false, only previously downloaded grapes will be used. This may cause failure in the grape call if the library has not yet been downloaded

    If it is set to true, then any jars not already downloaded will automatically be downloaded. Also, any versions expressed as a range will be checked for new versions and downloaded (with dependencies) if found.

    By default, it is set to true.

  - ### setEnableAutoDownload

    public static void setEnableAutoDownload(boolean enableAutoDownload)
    This is a static access auto download enabler. It will set the 'autoDownload' value to the passed in arguments map if not already set. If 'autoDownload' is set the value will not be adjusted.

    This applies to the grab and resolve calls.

    If it is set to false, only previously downloaded grapes will be used. This may cause failure in the grape call if the library has not yet been downloaded.

    If it is set to true, then any jars not already downloaded will automatically be downloaded. Also, any versions expressed as a range will be checked for new versions and downloaded (with dependencies) if found. By default, it is set to true.

  - ### getDisableChecksums

    public static boolean getDisableChecksums()
    Global flag to ignore checksums. By default, it is set to false.

  - ### setDisableChecksums

    public static void setDisableChecksums(boolean disableChecksums)
    Set global flag to ignore checksums. By default, it is set to false.

  - ### getInstance

    public static GrapeEngine getInstance()
    Returns the shared grape engine instance.
    Returns:
      the shared engine, or `null` if grapes are unavailable

  - ### grab

    public static void grab(String endorsed)
    Grabs a dependency expressed using the endorsed module shorthand.
    Parameters:
      `endorsed` - the endorsed module notation

  - ### grab

    public static void grab(Map<String,Object> dependency)
    Grabs a single dependency.
    Parameters:
      `dependency` - the dependency descriptor

  - ### grab

    public static void grab(Map<String,Object> args, Map... dependencies)
    Grabs one or more dependencies using the supplied arguments.
    Parameters:
      `args` - grab arguments
      `dependencies` - dependency descriptors

  - ### enumerateGrapes

    public static Map<String,Map<String,List<String>>> enumerateGrapes()
    Enumerates locally available grapes.
    Returns:
      grapes grouped by organization and module

  - ### resolve

    public static URI[] resolve(Map<String,Object> args, Map... dependencies)
    Resolves dependency coordinates to URIs.
    Parameters:
      `args` - resolve arguments
      `dependencies` - dependency descriptors
    Returns:
      the resolved artifact URIs

  - ### resolve

    public static URI[] resolve(Map<String,Object> args, List depsInfo, Map... dependencies)
    Resolves dependency coordinates to URIs while optionally collecting dependency information.
    Parameters:
      `args` - resolve arguments
      `depsInfo` - optional dependency metadata sink
      `dependencies` - dependency descriptors
    Returns:
      the resolved artifact URIs

  - ### listDependencies

    public static Map[] listDependencies(ClassLoader cl)
    Lists dependencies associated with the supplied class loader.
    Parameters:
      `cl` - the class loader to inspect
    Returns:
      the dependency descriptors

  - ### addResolver

    public static void addResolver(Map<String,Object> args)
    Adds a resolver to the shared grape engine.
    Parameters:
      `args` - the resolver descriptor