Package maventest
Class MavenRepositorySystem
- java.lang.Object
-
- maventest.MavenRepositorySystem
-
public class MavenRepositorySystem extends java.lang.Object
Abstraction of the repository system for purposes of dependency resolution used by Maven
-
-
Constructor Summary
Constructors Constructor Description MavenRepositorySystem()
-
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 artifactorg.sonatype.aether.resolution.DependencyResult
resolveDependencies(org.sonatype.aether.RepositorySystemSession session, org.sonatype.aether.resolution.DependencyRequest request)
-
-
-
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 systemsettings
- 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 POMsession
- 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 sessionrequest
- The request to be computed- Returns:
- The artifact
- Throws:
org.sonatype.aether.resolution.ArtifactResolutionException
- If the artifact could not be fetched
-
-