Package maventest

Class MavenModelResolver

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

    public class MavenModelResolver
    extends java.lang.Object
    implements org.apache.maven.model.resolution.ModelResolver
    Resolves an artifact even from remote repository during resolution of the model. The repositories are added to the resolution chain as found during processing of the POM file. Repository is added only if there is no other repository with same id already defined.
    • Constructor Summary

      Constructors 
      Constructor Description
      MavenModelResolver​(org.sonatype.aether.RepositorySystem system, org.sonatype.aether.RepositorySystemSession session, java.util.List<org.sonatype.aether.repository.RemoteRepository> remotes)
      Creates a new Maven repository resolver.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addRepository​(org.apache.maven.model.Repository repository)  
      org.apache.maven.model.resolution.ModelResolver newCopy()  
      org.apache.maven.model.building.ModelSource resolveModel​(java.lang.String groupId, java.lang.String artifactId, java.lang.String version)  
      • Methods inherited from class java.lang.Object

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

      • MavenModelResolver

        public MavenModelResolver​(org.sonatype.aether.RepositorySystem system,
                                  org.sonatype.aether.RepositorySystemSession session,
                                  java.util.List<org.sonatype.aether.repository.RemoteRepository> remotes)
        Creates a new Maven repository resolver. This resolver uses service available to Maven to create an artifact resolution chain
        Parameters:
        system - the Maven based implementation of the RepositorySystem
        session - the current Maven execution session
        remotes - Currently available remote repositories
    • Method Detail

      • addRepository

        public void addRepository​(org.apache.maven.model.Repository repository)
                           throws org.apache.maven.model.resolution.InvalidRepositoryException
        Specified by:
        addRepository in interface org.apache.maven.model.resolution.ModelResolver
        Throws:
        org.apache.maven.model.resolution.InvalidRepositoryException
      • newCopy

        public org.apache.maven.model.resolution.ModelResolver newCopy()
        Specified by:
        newCopy in interface org.apache.maven.model.resolution.ModelResolver
      • resolveModel

        public org.apache.maven.model.building.ModelSource resolveModel​(java.lang.String groupId,
                                                                        java.lang.String artifactId,
                                                                        java.lang.String version)
                                                                 throws org.apache.maven.model.resolution.UnresolvableModelException
        Specified by:
        resolveModel in interface org.apache.maven.model.resolution.ModelResolver
        Throws:
        org.apache.maven.model.resolution.UnresolvableModelException