Package org.gradle.api.artifacts

## Interface MutableVersionConstraint

- All Superinterfaces:
    `VersionConstraint`

      @Incubating
      public interface MutableVersionConstraint
      extends VersionConstraint

  A configurable version constraint. This is exposed to the build author, so that one can express more constraints on a version,
  Since:
    4.4

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.lang.String` | `getBranch​()` | Returns the branch to select versions from.
    `void` | `prefer​(java.lang.String version)` | Sets the preferred version of this module.
    `void` | `reject​(java.lang.String... versions)` | Declares a list of rejected versions.
    `void` | `rejectAll​()` | Rejects all versions of this component.
    `void` | `require​(java.lang.String version)` | Sets the required version of this module.
    `void` | `setBranch​(java.lang.String branch)` | Specifies the branch to select versions from.
    `void` | `strictly​(java.lang.String version)` | Sets the version as strict, meaning that if any other dependency version for this module disagrees with this version, resolution will fail.

    - ### Methods inherited from interface org.gradle.api.artifacts.VersionConstraint

      `getPreferredVersion, getRejectedVersions, getRequiredVersion, getStrictVersion`

- - ### Method Detail

    - #### getBranch

          @Nullable
          java.lang.String getBranch​()

      Returns the branch to select versions from. When not `null`, select only versions that were built from the given branch.
      Specified by:
        `getBranch` in interface `VersionConstraint`
      Since:
        4.6

    - #### setBranch

          void setBranch​(@Nullable
                         java.lang.String branch)

      Specifies the branch to select versions from.
      Parameters:
        `branch` - The branch, possibly null.
      Since:
        4.6

    - #### require

          void require​(java.lang.String version)

      Sets the required version of this module. Any other version constraints will be overriden.
      Parameters:
        `version` - the required version of this module
      Since:
        5.0

    - #### prefer

          void prefer​(java.lang.String version)

      Sets the preferred version of this module. Any other version constraints will be overriden.
      Parameters:
        `version` - the preferred version of this module

    - #### strictly

          void strictly​(java.lang.String version)

      Sets the version as strict, meaning that if any other dependency version for this module disagrees with this version, resolution will fail. Any other version constraints will be overriden.
      Parameters:
        `version` - the strict version to be used for this module

    - #### reject

          void reject​(java.lang.String... versions)

      Declares a list of rejected versions. If such a version is found during dependency resolution, it will not be selected.
      Parameters:
        `versions` - the rejected versions
      Since:
        4.5

    - #### rejectAll

          void rejectAll​()

      Rejects all versions of this component. Can be used to declare that a component is incompatible with another (typically, cannot have both a 2 different implementations of the same API).
      Since:
        4.5