Package org.openrewrite.gradle
Class DependencyVersionSelector
java.lang.Object
org.openrewrite.gradle.DependencyVersionSelector
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 -
Method Summary
Modifier and TypeMethodDescription@Nullable Stringselect(org.openrewrite.maven.tree.GroupArtifact ga, 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 Stringselect(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 Stringselect(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 Stringselect(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.
-
Constructor Details
-
DependencyVersionSelector
public DependencyVersionSelector()
-
-
Method Details
-
select
public @Nullable String select(org.openrewrite.maven.tree.GroupArtifact ga, 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. * @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, @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 upgradectx- 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.
-