VersionCatalogBuilder (Gradle API 7.6.3)

Package org.gradle.api.initialization.dsl

## Interface VersionCatalogBuilder

- All Superinterfaces:
    `Named`

      public interface VersionCatalogBuilder
      extends Named

  A version catalog builder. Dependencies defined via this model will trigger the generation of accessors available in build scripts.
  Since:
    7.0

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface | Description
    --- | --- | ---
    `static interface` | `VersionCatalogBuilder.AliasBuilder` | Deprecated. With the removal of `alias(String)`, this class will no longer needed.
    `static interface` | `VersionCatalogBuilder.LibraryAliasBuilder` | Allows configuring the version of a library
    `static interface` | `VersionCatalogBuilder.PluginAliasBuilder` | Allows configuring the version of a plugin

    - ### Nested classes/interfaces inherited from interface org.gradle.api.Named

      `Named.Namer`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `VersionCatalogBuilder.AliasBuilder` | `alias​(java.lang.String alias)` | Deprecated. Use `library(String, String, String)`, `library(String, String)` and `plugin(String, String)` instead.
    `void` | `bundle​(java.lang.String alias, java.util.List<java.lang.String> aliases)` | Declares a bundle of dependencies.
    `void` | `from​(java.lang.Object dependencyNotation)` | Configures the model by reading it from a version catalog.
    `Property<java.lang.String>` | `getDescription()` | A description for the dependencies model, which will be used in the generated sources as documentation.
    `java.lang.String` | `getLibrariesExtensionName()` | Returns the name of the extension configured by this builder
    `void` | `library​(java.lang.String alias, java.lang.String groupArtifactVersion)` | Declare a library alias in full.
    `VersionCatalogBuilder.LibraryAliasBuilder` | `library​(java.lang.String alias, java.lang.String group, java.lang.String artifact)` | Entry point for registering a library alias.
    `VersionCatalogBuilder.PluginAliasBuilder` | `plugin​(java.lang.String alias, java.lang.String id)` | Entry point for registering a plugin alias.
    `java.lang.String` | `version​(java.lang.String alias, java.lang.String version)` | Configures a dependency version which can then be referenced using the `VersionCatalogBuilder.LibraryAliasBuilder.versionRef(String)` method.
    `java.lang.String` | `version​(java.lang.String alias, Action<? super MutableVersionConstraint> versionSpec)` | Configures a dependency version which can then be referenced using the `VersionCatalogBuilder.LibraryAliasBuilder.versionRef(String)` )} method.

    - ### Methods inherited from interface org.gradle.api.Named

      `getName`

- - ### Method Detail

    - #### getDescription

          Property<java.lang.String> getDescription()

      A description for the dependencies model, which will be used in the generated sources as documentation.
      Returns:
        the description for this model

    - #### from

          void from​(java.lang.Object dependencyNotation)

      Configures the model by reading it from a version catalog. A version catalog is a component published using the `version-catalog` plugin or a local TOML file.

      This function can be called only once, further calls will result in an error. The passed notation should conform these constraints:

      - If a file notation is passed, it should be a single file.
      - If it's a resolvable dependency, it should resolve to a single file.

      If the notation doesn't conform these constraints, an exception will be thrown at configuration time.

      Parameters:
        `dependencyNotation` - any notation supported by `DependencyHandler`

    - #### version

          java.lang.String version​(java.lang.String alias,
                                   Action<? super MutableVersionConstraint> versionSpec)

      Configures a dependency version which can then be referenced using the `VersionCatalogBuilder.LibraryAliasBuilder.versionRef(String)` )} method.
      Parameters:
        `alias` - an identifier for the version
        `versionSpec` - the dependency version spec
      Returns:
        the version alias name

    - #### version

          java.lang.String version​(java.lang.String alias,
                                   java.lang.String version)

      Configures a dependency version which can then be referenced using the `VersionCatalogBuilder.LibraryAliasBuilder.versionRef(String)` method.
      Parameters:
        `alias` - an identifier for the version
        `version` - the version alias name

    - #### alias

          @Deprecated
          VersionCatalogBuilder.AliasBuilder alias​(java.lang.String alias)

      Deprecated.
      Use `library(String, String, String)`, `library(String, String)` and `plugin(String, String)` instead. Will be removed in Gradle 8.
      Entry point for registering an alias for a library.
      Parameters:
        `alias` - the alias identifier
      Returns:
        a builder for this alias

    - #### library

          VersionCatalogBuilder.LibraryAliasBuilder library​(java.lang.String alias,
                                                            java.lang.String group,
                                                            java.lang.String artifact)

      Entry point for registering a library alias.
      Parameters:
        `alias` - the alias of the library
        `group` - the group of the library
        `artifact` - the artifact ID of the library
      Returns:
        a builder for this alias, to finish the version configuration
      Since:
        7.4

    - #### library

          void library​(java.lang.String alias,
                       java.lang.String groupArtifactVersion)

      Declare a library alias in full. This does not return a builder, as the declaration is fully complete. Use `library(String, String, String)` if you need a more complex version declaration.

      Note that declaring a classifier or extension using this method is not possible.

      Parameters:
        `alias` - the alias of the library
        `groupArtifactVersion` - the `group:artifact:version` string, all components are required
      Since:
        7.4

    - #### plugin

          VersionCatalogBuilder.PluginAliasBuilder plugin​(java.lang.String alias,
                                                          java.lang.String id)

      Entry point for registering a plugin alias.
      Parameters:
        `alias` - the alias of the plugin
        `id` - the ID of the plugin
      Returns:
        a builder for this alias, to finish the version configuration
      Since:
        7.4

    - #### bundle

          void bundle​(java.lang.String alias,
                      java.util.List<java.lang.String> aliases)

      Declares a bundle of dependencies. A bundle consists of a name for the bundle, and a list of aliases. The aliases must correspond to aliases defined via the `library()` methods.
      Parameters:
        `alias` - the alias of the bundle
        `aliases` - the aliases of the dependencies included in the bundle
      See Also:
        `library(String, String, String)`, `library(String, String)`

    - #### getLibrariesExtensionName

          java.lang.String getLibrariesExtensionName()

      Returns the name of the extension configured by this builder