Class FileCacheResolver

java.lang.Object
software.amazon.smithy.cli.dependencies.FileCacheResolver
All Implemented Interfaces:
DependencyResolver

public final class FileCacheResolver extends Object implements DependencyResolver
A resolver that loads and caches resolved artifacts to a JSON file if the cache is fresh and resolved artifacts haven't been updated after a given reference point in time.
  • Constructor Details

    • FileCacheResolver

      public FileCacheResolver(File location, long referenceTimeInMillis, DependencyResolver delegate)
      Parameters:
      location - The location to the cache.
      referenceTimeInMillis - Invalidate cache items if this time is newer than the cache item time.
      delegate - Resolver to delegate to when dependencies aren't cached.
  • Method Details

    • addRepository

      public void addRepository(MavenRepository repository)
      Description copied from interface: DependencyResolver
      Add a Maven repository.
      Specified by:
      addRepository in interface DependencyResolver
      Parameters:
      repository - Repository to add.
    • addDependency

      public void addDependency(String coordinates)
      Description copied from interface: DependencyResolver
      Add a dependency.

      Coordinates must be given a group ID, artifact ID, and version in the form of "groupId:artifactId:version". Coordinates support Maven dependency ranges. Coordinates do not support LATEST, SNAPSHOT, latest-release, latest.*, or Gradle style "+" syntax.

      Specified by:
      addDependency in interface DependencyResolver
      Parameters:
      coordinates - Dependency coordinates to add.
    • resolve

      public List<ResolvedArtifact> resolve()
      Description copied from interface: DependencyResolver
      Resolves artifacts for the configured dependencies.
      Specified by:
      resolve in interface DependencyResolver
      Returns:
      Returns the resolved artifacts, including file on disk and coordinates.