Class DependencyVersionSelector

java.lang.Object
org.openrewrite.gradle.DependencyVersionSelector

@Incubating(since="8.17.0") public class DependencyVersionSelector extends Object
Selects versions for new or existing dependencies based on a node-semver selector by inspecting available versions in the Maven metadata from a set of Maven repositories.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable String
    select(org.openrewrite.maven.tree.GroupArtifact ga, @Nullable String configuration, @Nullable String version, @Nullable String versionPattern, org.openrewrite.ExecutionContext ctx)
    Used to select a version for a new dependency that has no prior version, or the caller is not sure what the prior version is.
    @Nullable String
    select(org.openrewrite.maven.tree.GroupArtifactVersion gav, @Nullable String configuration, @Nullable String version, @Nullable String versionPattern, org.openrewrite.ExecutionContext ctx)
    Used to upgrade a version for a dependency that already has a version.
    @Nullable String
    select(org.openrewrite.maven.tree.GroupArtifactVersion gav, @Nullable String configuration, @Nullable String version, org.openrewrite.semver.VersionComparator versionComparator, org.openrewrite.ExecutionContext ctx)
    Used to upgrade a version for a dependency that already has a version.
    @Nullable String
    select(org.openrewrite.maven.tree.ResolvedGroupArtifactVersion gav, String configuration, @Nullable String version, @Nullable String versionPattern, org.openrewrite.ExecutionContext ctx)
    Used to upgrade a version for a dependency that already has a version.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DependencyVersionSelector

      public DependencyVersionSelector()
  • Method Details

    • select

      public @Nullable String select(org.openrewrite.maven.tree.GroupArtifact ga, @Nullable String configuration, @Nullable String version, @Nullable String versionPattern, org.openrewrite.ExecutionContext ctx) throws org.openrewrite.maven.MavenDownloadingException
      Used to select a version for a new dependency that has no prior version, or the caller is not sure what the prior version is.
      Parameters:
      ga - The group and artifact of the new dependency.
      configuration - The configuration to select the version for. The configuration influences which set of Maven repositories (either plugin repositories or regular repositories) are used to resolve Maven metadata from.
      version - The version to select, in node-semver format.
      versionPattern - The version pattern to select, if any.
      ctx - The execution context, which can influence dependency resolution.
      Returns:
      The selected version, if any.
      Throws:
      org.openrewrite.maven.MavenDownloadingException - If there is a problem downloading metadata for the dependency.
    • select

      public @Nullable String select(org.openrewrite.maven.tree.ResolvedGroupArtifactVersion gav, String configuration, @Nullable String version, @Nullable String versionPattern, org.openrewrite.ExecutionContext ctx) throws org.openrewrite.maven.MavenDownloadingException
      Used to upgrade a version for a dependency that already has a version.
      Parameters:
      gav - The group, artifact, and version of the existing dependency.
      configuration - The configuration to select the version for. The configuration influences which set of Maven repositories (either plugin repositories or regular repositories) are used to resolve Maven metadata from.
      version - The version to select, in node-semver format.
      versionPattern - The version pattern to select, if any.
      ctx - The execution context, which can influence dependency resolution.
      Returns:
      The selected version, if any.
      Throws:
      org.openrewrite.maven.MavenDownloadingException - If there is a problem downloading metadata for the dependency.
    • select

      public @Nullable String select(org.openrewrite.maven.tree.GroupArtifactVersion gav, @Nullable String configuration, @Nullable String version, @Nullable String versionPattern, org.openrewrite.ExecutionContext ctx) throws org.openrewrite.maven.MavenDownloadingException
      Used to upgrade a version for a dependency that already has a version.
      Parameters:
      gav - The group, artifact, and version of the existing dependency.
      configuration - The configuration to select the version for. The configuration influences which set of Maven repositories (either plugin repositories or regular repositories) are used to resolve Maven metadata from. * @param version The version to select, in node-semver format.
      versionPattern - The version pattern to select, if any.
      ctx - The execution context, which can influence dependency resolution.
      Returns:
      The selected version, if any.
      Throws:
      org.openrewrite.maven.MavenDownloadingException - If there is a problem downloading metadata for the dependency.
    • select

      public @Nullable String select(org.openrewrite.maven.tree.GroupArtifactVersion gav, @Nullable String configuration, @Nullable String version, org.openrewrite.semver.VersionComparator versionComparator, org.openrewrite.ExecutionContext ctx) throws org.openrewrite.maven.MavenDownloadingException
      Used to upgrade a version for a dependency that already has a version.
      Parameters:
      gav - The group, artifact, and version of the existing dependency.
      configuration - The configuration to select the version for. The configuration influences which set of Maven repositories (either plugin repositories or regular repositories) are used to resolve Maven metadata from. * @param version The version to select, in node-semver format.
      versionComparator - the comparator used to establish the validity of a potential upgrade
      ctx - The execution context, which can influence dependency resolution.
      Returns:
      The selected version, if any.
      Throws:
      org.openrewrite.maven.MavenDownloadingException - If there is a problem downloading metadata for the dependency.