Class DefaultModelResolver

  • All Implemented Interfaces:
    ModelResolver

    class DefaultModelResolver
    extends java.lang.Object
    implements ModelResolver
    A model resolver to assist building of dependency POMs. This resolver gives priority to those repositories that have been initially specified and repositories discovered in dependency POMs are recessively merged into the search chain.
    See Also:
    DefaultArtifactDescriptorReader
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String context  
      private java.util.List<org.eclipse.aether.repository.RemoteRepository> externalRepositories  
      private org.eclipse.aether.impl.RemoteRepositoryManager remoteRepositoryManager  
      private java.util.List<org.eclipse.aether.repository.RemoteRepository> repositories  
      private java.util.Set<java.lang.String> repositoryIds  
      private org.eclipse.aether.impl.ArtifactResolver resolver  
      private org.eclipse.aether.RepositorySystemSession session  
      private org.eclipse.aether.RequestTrace trace  
      private org.eclipse.aether.impl.VersionRangeResolver versionRangeResolver  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private DefaultModelResolver​(DefaultModelResolver original)  
      (package private) DefaultModelResolver​(org.eclipse.aether.RepositorySystemSession session, org.eclipse.aether.RequestTrace trace, java.lang.String context, org.eclipse.aether.impl.ArtifactResolver resolver, org.eclipse.aether.impl.VersionRangeResolver versionRangeResolver, org.eclipse.aether.impl.RemoteRepositoryManager remoteRepositoryManager, java.util.List<org.eclipse.aether.repository.RemoteRepository> repositories)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addRepository​(Repository repository)
      Adds a repository to use for subsequent resolution requests.
      void addRepository​(Repository repository, boolean replace)
      Adds a repository to use for subsequent resolution requests.
      ModelResolver newCopy()
      Clones this resolver for usage in a forked resolution process.
      private static void removeMatchingRepository​(java.lang.Iterable<org.eclipse.aether.repository.RemoteRepository> repositories, java.lang.String id)  
      ModelSource resolveModel​(java.lang.String groupId, java.lang.String artifactId, java.lang.String version)
      Tries to resolve the POM for the specified coordinates.
      ModelSource resolveModel​(Dependency dependency)
      Tries to resolve the POM for the specified dependency coordinates possibly updating dependency.
      ModelSource resolveModel​(Parent parent)
      Tries to resolve the POM for the specified parent coordinates possibly updating parent.
      • Methods inherited from class java.lang.Object

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

      • session

        private final org.eclipse.aether.RepositorySystemSession session
      • trace

        private final org.eclipse.aether.RequestTrace trace
      • context

        private final java.lang.String context
      • repositories

        private java.util.List<org.eclipse.aether.repository.RemoteRepository> repositories
      • externalRepositories

        private final java.util.List<org.eclipse.aether.repository.RemoteRepository> externalRepositories
      • resolver

        private final org.eclipse.aether.impl.ArtifactResolver resolver
      • versionRangeResolver

        private final org.eclipse.aether.impl.VersionRangeResolver versionRangeResolver
      • remoteRepositoryManager

        private final org.eclipse.aether.impl.RemoteRepositoryManager remoteRepositoryManager
      • repositoryIds

        private final java.util.Set<java.lang.String> repositoryIds
    • Constructor Detail

      • DefaultModelResolver

        DefaultModelResolver​(org.eclipse.aether.RepositorySystemSession session,
                             org.eclipse.aether.RequestTrace trace,
                             java.lang.String context,
                             org.eclipse.aether.impl.ArtifactResolver resolver,
                             org.eclipse.aether.impl.VersionRangeResolver versionRangeResolver,
                             org.eclipse.aether.impl.RemoteRepositoryManager remoteRepositoryManager,
                             java.util.List<org.eclipse.aether.repository.RemoteRepository> repositories)
    • Method Detail

      • addRepository

        public void addRepository​(Repository repository)
                           throws InvalidRepositoryException
        Description copied from interface: ModelResolver
        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 ModelResolver
        Parameters:
        repository - The repository to add to the internal search chain, must not be null.
        Throws:
        InvalidRepositoryException - If the repository could not be added (e.g. due to invalid URL or layout).
      • addRepository

        public void addRepository​(Repository repository,
                                  boolean replace)
                           throws InvalidRepositoryException
        Description copied from interface: ModelResolver
        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, then the value of the replace argument is determines the behaviour. If replace is false than any existing repository with the same Id will remain in use. If replace is true the new repository replaces the original.
        Specified by:
        addRepository in interface ModelResolver
        Parameters:
        repository - The repository to add to the internal search chain, must not be null.
        Throws:
        InvalidRepositoryException - If the repository could not be added (e.g. due to invalid URL or layout).
      • removeMatchingRepository

        private static void removeMatchingRepository​(java.lang.Iterable<org.eclipse.aether.repository.RemoteRepository> repositories,
                                                     java.lang.String id)
      • newCopy

        public ModelResolver newCopy()
        Description copied from interface: ModelResolver
        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 ModelResolver.addRepository(Repository) on the clone do not affect the state of the original resolver and vice versa.
        Specified by:
        newCopy in interface ModelResolver
        Returns:
        The cloned resolver, never null.
      • resolveModel

        public ModelSource resolveModel​(java.lang.String groupId,
                                        java.lang.String artifactId,
                                        java.lang.String version)
                                 throws UnresolvableModelException
        Description copied from interface: ModelResolver
        Tries to resolve the POM for the specified coordinates.
        Specified by:
        resolveModel in interface ModelResolver
        Parameters:
        groupId - The group identifier of the POM, must not be null.
        artifactId - 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:
        UnresolvableModelException - If the POM could not be resolved from any configured repository.