Package: groovy.grape.maven

## [Groovy] Class GrapeMaven

- groovy.grape.maven.GrapeMaven

- All Implemented Interfaces and Traits:
    GrapeEngine

      @AutoFinal
      @CompileStatic
      class GrapeMaven
      extends Object
      implements GrapeEngine

  Implementation supporting `@Grape` and `@Grab` annotations based on Maven.

  Since:
    6.0.0

- - ### Properties Summary

    Properties
    Type | Name and description
    --- | ---
    `boolean` | `enableGrapes` Enables or disables grape resolution.
    `Set<MavenGrabRecord>` | `grabRecordsForCurrDependencies` Stores the MavenGrabRecord(s) for all dependencies in each grab() call.
    `Map<ClassLoader, Set<MavenGrabRecord>>` | `loadedDeps` Dependencies loaded into each class loader.
    `List<Closure>` | `progressListeners` Progress listeners notified during dependency resolution.
    `List<org.eclipse.aether.repository.RemoteRepository>` | `repos` Configured remote repositories in lookup order.

  - ### Constructor Summary

    Constructors
    Constructor and description
    `GrapeMaven()`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `void` | `addProgressListener(Closure listener)` Adds a progress listener for resolution events.
    `` | `void` | `addResolver(Map<String, Object> args)` Adds a repository resolver to the front of the repository list.
    `` | `static MavenGrabRecord` | `createGrabRecord(Map dep)` Converts dependency coordinates into a Maven grab record.
    `` | `Map<String, Map<String, List<String>>>` | `enumerateGrapes()` Enumerates cached grapes by group, module, and version.
    `` | `URI[]` | `getDependencies(Map args, List depsInfo, MavenGrabRecord[] grabRecords)` Resolves the supplied grab records with Maven Resolver.
    `` | `static File` | `getGrapeCacheDir()` Returns the cache directory used for downloaded artifacts.
    `` | `static File` | `getGrapeDir()` Returns the root directory used by grape.
    `` | `static File` | `getGroovyRoot()` Returns the configured Groovy home directory for grape state.
    `` | `Object` | `grab(String endorsedModule)` Grab the endorsed module for the current Groovy version.
    `` | `Object` | `grab(Map args)` Grabs a dependency described by a single argument map.
    `` | `Object` | `grab(Map args, Map[] dependencies)` Grabs one or more dependencies and adds them to the target class loader.
    `` | `Map[]` | `listDependencies(ClassLoader classLoader)` Lists dependencies already loaded into the supplied class loader.
    `` | `void` | `removeProgressListener(Closure listener)` Removes a previously registered progress listener.
    `` | `URI[]` | `resolve(Map args, Map[] dependencies)` Resolves dependencies using the implicit target class loader.
    `` | `URI[]` | `resolve(Map args, List depsInfo, Map[] dependencies)` Resolves dependencies and optionally collects dependency metadata.
    `` | `URI[]` | `resolve(ClassLoader loader, Map args, Map[] dependencies)` Resolves dependencies for an explicit class loader.
    `` | `URI[]` | `resolve(ClassLoader loader, Map args, List depsInfo, Map[] dependencies)` Resolves dependencies for an explicit class loader and optional metadata sink.
    `` | `void` | `setLoggingLevel(int level)` Updates the logging level used by grape integrations.
    `` | `void` | `uninstallArtifact(String group, String module, String rev)` Removes a cached artifact version from the grape cache.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Property Detail

    - #### boolean enableGrapes

      Enables or disables grape resolution.

    - #### final Set<MavenGrabRecord> grabRecordsForCurrDependencies

      Stores the MavenGrabRecord(s) for all dependencies in each grab() call.

    - #### final Map<ClassLoader, Set<MavenGrabRecord>> loadedDeps

      Dependencies loaded into each class loader.

    - #### final List<Closure> progressListeners

      Progress listeners notified during dependency resolution.

    - #### final List<org.eclipse.aether.repository.RemoteRepository> repos

      Configured remote repositories in lookup order.

  - ### Constructor Detail

    - #### GrapeMaven()

  - ### Method Detail

    - #### @CompileDynamic
      void addProgressListener(Closure listener)

      Adds a progress listener for resolution events.

      Parameters:
        `listener` - the listener to add

    - #### @Override
      void addResolver(@NamedParams(value=[@NamedParam(value="name", type=String, required=true), @NamedParam(value="root", type=String, required=true), @NamedParam(value="m2Compatible", type=Boolean, required=false)])
      Map<String, Object> args)

      Adds a repository resolver to the front of the repository list.

      Parameters:
        `args` - the resolver configuration

    - #### static MavenGrabRecord createGrabRecord(Map dep)

      Converts dependency coordinates into a Maven grab record.

      Parameters:
        `dep` - the dependency map
      Returns:
        the corresponding grab record

    - #### @Override
      @CompileDynamic
      Map<String, Map<String, List<String>>> enumerateGrapes()

      Enumerates cached grapes by group, module, and version.

      Returns:
        the cached grape coordinates

    - #### URI[] getDependencies(Map args, List depsInfo, MavenGrabRecord[] grabRecords)

      Resolves the supplied grab records with Maven Resolver.

      Parameters:
        `args` - the resolution arguments
        `depsInfo` - the optional dependency metadata sink
        `grabRecords` - the dependencies to resolve
      Returns:
        the resolved artifact URIs

    - #### static File getGrapeCacheDir()

      Returns the cache directory used for downloaded artifacts.

      Returns:
        the grape cache directory

    - #### static File getGrapeDir()

      Returns the root directory used by grape.

      Returns:
        the grape root directory

    - #### static File getGroovyRoot()

      Returns the configured Groovy home directory for grape state.

      Returns:
        the Groovy home directory

    - #### @Override
      Object grab(String endorsedModule)

      Grab the endorsed module for the current Groovy version.

    - #### @Override
      Object grab(Map args)

      Grabs a dependency described by a single argument map.

      Parameters:
        `args` - the grab arguments
      Returns:
        the grab result or exception when suppressed

    - #### @Override
      Object grab(Map args, Map[] dependencies)

      Grabs one or more dependencies and adds them to the target class loader.

      Parameters:
        `args` - the shared grab arguments
        `dependencies` - the dependency descriptors
      Returns:
        `null` on success or the suppressed exception

    - #### @Override
      Map[] listDependencies(ClassLoader classLoader)

      Lists dependencies already loaded into the supplied class loader.

      Parameters:
        `classLoader` - the class loader to inspect
      Returns:
        the loaded dependency descriptors

    - #### void removeProgressListener(Closure listener)

      Removes a previously registered progress listener.

      Parameters:
        `listener` - the listener to remove

    - #### @Override
      URI[] resolve(Map args, Map[] dependencies)

      Resolves dependencies using the implicit target class loader.

      Parameters:
        `args` - the resolution arguments
        `dependencies` - the dependencies to resolve
      Returns:
        the resolved artifact URIs

    - #### @Override
      URI[] resolve(Map args, List depsInfo, Map[] dependencies)

      Resolves dependencies and optionally collects dependency metadata.

      Parameters:
        `args` - the resolution arguments
        `depsInfo` - the optional dependency metadata sink
        `dependencies` - the dependencies to resolve
      Returns:
        the resolved artifact URIs

    - #### URI[] resolve(ClassLoader loader, Map args, Map[] dependencies)

      Resolves dependencies for an explicit class loader.

      Parameters:
        `loader` - the target class loader
        `args` - the resolution arguments
        `dependencies` - the dependencies to resolve
      Returns:
        the resolved artifact URIs

    - #### URI[] resolve(ClassLoader loader, Map args, List depsInfo, Map[] dependencies)

      Resolves dependencies for an explicit class loader and optional metadata sink.

      Parameters:
        `loader` - the target class loader
        `args` - the resolution arguments
        `depsInfo` - the optional dependency metadata sink
        `dependencies` - the dependencies to resolve
      Returns:
        the resolved artifact URIs

    - #### @Override
      void setLoggingLevel(int level)

      Updates the logging level used by grape integrations.

      Parameters:
        `level` - the grape logging level

    - #### void uninstallArtifact(String group, String module, String rev)

      Removes a cached artifact version from the grape cache.

      Parameters:
        `group` - the artifact group
        `module` - the artifact module
        `rev` - the artifact revision