Interface CandidateVersionResolver

All Known Implementing Classes:
SessionCandidateVersionResolver

public interface CandidateVersionResolver
Resolves the available released versions of a Maven coordinate.

Pure interface so FoundationBaker can be unit tested with a fake (no Maven session, no network). The SessionCandidateVersionResolver implementation queries the Maven 4 VersionRangeResolver service against the configured remote and local repositories.

Implementations MUST:

  • Filter out SNAPSHOT versions — foundation resolution only ever proposes released versions.
  • Return versions in ascending order, with the highest at the end of the list.
  • Return an empty list (not null) when nothing is available or the coordinate cannot be resolved.
  • Method Summary

    Modifier and Type
    Method
    Description
    resolveCandidates(String groupId, String artifactId, String currentVersion)
    Look up all known released versions of groupId:artifactId.
    default String
    resolveHighestCandidate(String groupId, String artifactId, String currentVersion)
    Convenience: return the highest released candidate strictly newer than currentVersion, or null if there isn't one.
  • Method Details

    • resolveCandidates

      List<String> resolveCandidates(String groupId, String artifactId, String currentVersion)
      Look up all known released versions of groupId:artifactId.

      Implementations may use currentVersion as a hint — e.g. to construct a Maven version range like "(currentVersion,)" that only returns strictly newer versions. Callers must not depend on that filtering: they should still compare returned versions against the current version themselves.

      Parameters:
      groupId - the coordinate's groupId
      artifactId - the coordinate's artifactId
      currentVersion - the currently-declared version, used as a hint for range-based resolvers; may be null
      Returns:
      ascending list of released versions; empty if none
    • resolveHighestCandidate

      default String resolveHighestCandidate(String groupId, String artifactId, String currentVersion)
      Convenience: return the highest released candidate strictly newer than currentVersion, or null if there isn't one. Compares versions with MavenVersionComparator.INSTANCE.
      Parameters:
      groupId - the coordinate's groupId
      artifactId - the coordinate's artifactId
      currentVersion - the currently-declared version
      Returns:
      the highest strictly-newer candidate, or null