Class MavenLocalFileFinder

  • All Implemented Interfaces:
    CachedArtifactFinder

    public class MavenLocalFileFinder
    extends java.lang.Object
    implements CachedArtifactFinder

    Searches a locally-installed Maven repository for locally-cached artifacts.

    Consumers of this class are responsible for installing and configuring Maven with the standard Maven environment variables. For example, M2_REPO.

    • Constructor Summary

      Constructors 
      Constructor Description
      MavenLocalFileFinder()
      Create an instance with default state.
      MavenLocalFileFinder​(java.net.URI repoLocation)
      Create an instance that will do its work at the given repoLocation.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      RepoResult find​(java.lang.String coordinates)
      Searches a dependency management system's locally-cached artifacts.
      • Methods inherited from class java.lang.Object

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

      • MavenLocalFileFinder

        public MavenLocalFileFinder()

        Create an instance with default state. The created instance will attempt to locate and work with a Maven installation's local file system dependency cache it assumes will be installed at a standard default location. It will look for an M2_REPO environment variable It will also look for a maven.local.repo System property.

        If no such environment or property is found, it will assume the caller intends for this instance to work with a local Maven dependency cache located in the home directory of the current user.

        The methods of this instance operate in the context of the locations described above.

      • MavenLocalFileFinder

        public MavenLocalFileFinder​(java.net.URI repoLocation)

        Create an instance that will do its work at the given repoLocation.

        The created instance will attempt to locate and work with a Maven installation's local file system dependency cache it assumes will be installed at the specified URI.

        The methods of this instance operate in the context of the location of the specified URI.

        Parameters:
        repoLocation - The location on the local file system where a dependency cache can be found.
    • Method Detail

      • find

        public RepoResult find​(java.lang.String coordinates)
        Description copied from interface: CachedArtifactFinder

        Searches a dependency management system's locally-cached artifacts.

        This operation assumes artifact caches can be found at certain standard locations on the local file system.

        Specified by:
        find in interface CachedArtifactFinder
        Parameters:
        coordinates - A non-empty, colon-delimited string of the form: „group:artifact:version[:classifier]“. Commonly referred to as „GAV“ coordinates, this is the standard addressing scheme dependency management systems use to distinguish individual modules from one another.
        Returns:
        A composite result that Optionally holds the artifact specified by the given coordinates (if found) and its parent folder.