Class AetherModelResolver
- java.lang.Object
-
- jadex.platform.service.dependency.maven.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.
-
-
-
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 interfaceorg.apache.maven.model.resolution.ModelResolver
- Parameters:
groupid
- The group identifier of the POM, must not benull
.id
- The artifact identifier of the POM, must not benull
.version
- The version of the POM, must not benull
.- 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 interfaceorg.apache.maven.model.resolution.ModelResolver
- Parameters:
repository
- The repository to add to the internal search chain, must not benull
.- 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 ofaddRepository(Repository)
on the clone do not affect the state of the original resolver and vice versa.- Specified by:
newCopy
in interfaceorg.apache.maven.model.resolution.ModelResolver
- Returns:
- The cloned resolver, never
null
.
-
-