Package maventest

Class MavenRepositorySystem


  • public class MavenRepositorySystem
    extends java.lang.Object
    Abstraction of the repository system for purposes of dependency resolution used by Maven
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<org.sonatype.aether.repository.RemoteRepository> getRemoteRepositories()  
      org.sonatype.aether.RepositorySystemSession getSession()
      Spawns a working session from the repository system.
      org.apache.maven.model.Model loadPom​(org.apache.maven.model.building.ModelSource pom, org.sonatype.aether.RepositorySystemSession session)
      Loads a POM file and updates settings both in current system and the session.
      org.sonatype.aether.resolution.ArtifactResult resolveArtifact​(org.sonatype.aether.RepositorySystemSession session, org.sonatype.aether.resolution.ArtifactRequest request)
      Resolves an artifact
      org.sonatype.aether.resolution.DependencyResult resolveDependencies​(org.sonatype.aether.RepositorySystemSession session, org.sonatype.aether.resolution.DependencyRequest request)  
      • Methods inherited from class java.lang.Object

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

      • MavenRepositorySystem

        public MavenRepositorySystem()
    • Method Detail

      • getSession

        public org.sonatype.aether.RepositorySystemSession getSession()
        Spawns a working session from the repository system. Working session is shared between all Maven based commands
        Parameters:
        system - A repository system
        settings - A configuration of current session, such as local or remote repositories and listeners
        Returns:
        The working session for dependency resolution
      • loadPom

        public org.apache.maven.model.Model loadPom​(org.apache.maven.model.building.ModelSource pom,
                                                    org.sonatype.aether.RepositorySystemSession session)
        Loads a POM file and updates settings both in current system and the session. Namely remote repositories are updated using the settings found in the POM file.
        Parameters:
        pom - The POM file which contains either settings or a reference to a parent POM
        session - The session to be used to fetch possible parents
        Returns:
        The model generated from the POM file
        Throws:
        ResolutionException - If dependency resolution, such as retrieving an artifact parent fails
      • getRemoteRepositories

        public java.util.List<org.sonatype.aether.repository.RemoteRepository> getRemoteRepositories()
      • resolveDependencies

        public org.sonatype.aether.resolution.DependencyResult resolveDependencies​(org.sonatype.aether.RepositorySystemSession session,
                                                                                   org.sonatype.aether.resolution.DependencyRequest request)
                                                                            throws org.sonatype.aether.resolution.DependencyResolutionException
        Throws:
        org.sonatype.aether.resolution.DependencyResolutionException
      • resolveArtifact

        public org.sonatype.aether.resolution.ArtifactResult resolveArtifact​(org.sonatype.aether.RepositorySystemSession session,
                                                                             org.sonatype.aether.resolution.ArtifactRequest request)
                                                                      throws org.sonatype.aether.resolution.ArtifactResolutionException
        Resolves an artifact
        Parameters:
        session - The current Maven session
        request - The request to be computed
        Returns:
        The artifact
        Throws:
        org.sonatype.aether.resolution.ArtifactResolutionException - If the artifact could not be fetched