Class AetherModelResolver

  • All Implemented Interfaces:
    org.apache.maven.model.resolution.ModelResolver

    public class AetherModelResolver
    extends java.lang.Object
    implements org.apache.maven.model.resolution.ModelResolver
    Model resolver implementation using aether.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.List<org.sonatype.aether.repository.RemoteRepository> repositories
      The remote repositories.
      protected org.apache.maven.repository.internal.MavenRepositorySystemSession session
      The repository system session.
      protected org.sonatype.aether.RepositorySystem system
      The aether repository system.
    • Constructor Summary

      Constructors 
      Constructor Description
      AetherModelResolver​(org.sonatype.aether.RepositorySystem system, org.apache.maven.repository.internal.MavenRepositorySystemSession session, java.util.List<org.sonatype.aether.repository.RemoteRepository> repositories)
      Create a new aether model resolver.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addRepository​(org.apache.maven.model.Repository repository)
      Adds a repository to use for subsequent resolution requests.
      org.apache.maven.model.resolution.ModelResolver newCopy()
      Clones this resolver for usage in a forked resolution process.
      org.apache.maven.model.building.ModelSource resolveModel​(java.lang.String groupid, java.lang.String id, java.lang.String version)
      Tries to resolve the POM for the specified coordinates.
      • Methods inherited from class java.lang.Object

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

      • system

        protected org.sonatype.aether.RepositorySystem system
        The aether repository system.
      • session

        protected org.apache.maven.repository.internal.MavenRepositorySystemSession session
        The repository system session.
      • repositories

        protected java.util.List<org.sonatype.aether.repository.RemoteRepository> repositories
        The remote repositories.
    • Constructor Detail

      • AetherModelResolver

        public AetherModelResolver​(org.sonatype.aether.RepositorySystem system,
                                   org.apache.maven.repository.internal.MavenRepositorySystemSession session,
                                   java.util.List<org.sonatype.aether.repository.RemoteRepository> repositories)
        Create a new aether model resolver.
    • Method Detail

      • resolveModel

        public org.apache.maven.model.building.ModelSource resolveModel​(java.lang.String groupid,
                                                                        java.lang.String id,
                                                                        java.lang.String version)
                                                                 throws org.apache.maven.model.resolution.UnresolvableModelException
        Tries to resolve the POM for the specified coordinates.
        Specified by:
        resolveModel in interface org.apache.maven.model.resolution.ModelResolver
        Parameters:
        groupid - The group identifier of the POM, must not be null.
        id - The artifact identifier of the POM, must not be null.
        version - The version of the POM, must not be null.
        Returns:
        The source of the requested POM, never null.
        Throws:
        org.apache.maven.model.resolution.UnresolvableModelException - If the POM could not be resolved from any configured repository.
      • addRepository

        public void addRepository​(org.apache.maven.model.Repository repository)
                           throws org.apache.maven.model.resolution.InvalidRepositoryException
        Adds a repository to use for subsequent resolution requests. The order in which repositories are added matters, repositories that were added first should also be searched first. When multiple repositories with the same identifier are added, only the first repository being added will be used.
        Specified by:
        addRepository in interface org.apache.maven.model.resolution.ModelResolver
        Parameters:
        repository - The repository to add to the internal search chain, must not be null.
        Throws:
        org.apache.maven.model.resolution.InvalidRepositoryException - If the repository could not be added (e.g. due to invalid URL or layout).
      • newCopy

        public org.apache.maven.model.resolution.ModelResolver newCopy()
        Clones this resolver for usage in a forked resolution process. In general, implementors need not provide a deep clone. The only requirement is that invocations of addRepository(Repository) on the clone do not affect the state of the original resolver and vice versa.
        Specified by:
        newCopy in interface org.apache.maven.model.resolution.ModelResolver
        Returns:
        The cloned resolver, never null.