public final class Aether
extends java.lang.Object
#143 This class should be @Immutable, but RemoteRepository is not immutable. Let's create a new class to encapsulate all necessary properties from RemoteRepository.
You need the following dependencies to have in classpath in order to to work with this class:
org.sonatype.aether:aether-api:1.13.1 org.apache.maven:maven-core:3.0.3
| Modifier and Type | Field and Description |
|---|---|
private java.io.File |
localRepo
Location of local repo.
|
private org.sonatype.aether.repository.RemoteRepository[] |
remotes
Remote project repositories.
|
private org.sonatype.aether.RepositorySystem |
system
Repository system.
|
| Constructor and Description |
|---|
Aether(org.sonatype.aether.repository.RemoteRepository[] remotes,
java.io.File repo)
Public ctor, requires information about all remote repos and one local.
|
| Modifier and Type | Method and Description |
|---|---|
private java.util.List<org.sonatype.aether.artifact.Artifact> |
fetch(org.sonatype.aether.RepositorySystemSession session,
org.sonatype.aether.resolution.DependencyRequest dreq)
Fetch dependencies.
|
private static java.util.Collection<java.lang.String> |
reps(java.util.Collection<org.sonatype.aether.repository.RemoteRepository> repos)
Convert a list of repositories into a list of strings.
|
private org.sonatype.aether.collection.CollectRequest |
request(org.sonatype.aether.graph.Dependency root)
Create collect request.
|
java.util.List<org.sonatype.aether.artifact.Artifact> |
resolve(org.sonatype.aether.artifact.Artifact root,
java.lang.String scope)
List of transitive deps of the artifact.
|
java.util.List<org.sonatype.aether.artifact.Artifact> |
resolve(org.sonatype.aether.artifact.Artifact root,
java.lang.String scope,
org.sonatype.aether.graph.DependencyFilter filter)
List of transitive deps of the artifact.
|
private org.sonatype.aether.RepositorySystemSession |
session()
Create RepositorySystemSession.
|
private final transient org.sonatype.aether.repository.RemoteRepository[] remotes
private final transient java.io.File localRepo
private final transient org.sonatype.aether.RepositorySystem system
public Aether(org.sonatype.aether.repository.RemoteRepository[] remotes,
java.io.File repo)
remotes - Remote repositoriesrepo - Local repository location (directory path)public java.util.List<org.sonatype.aether.artifact.Artifact> resolve(org.sonatype.aether.artifact.Artifact root,
java.lang.String scope)
throws org.sonatype.aether.resolution.DependencyResolutionException
root - The artifact to work withscope - The scope to work with ("runtime", "test", etc.)org.sonatype.aether.resolution.DependencyResolutionException - If can't fetch itpublic java.util.List<org.sonatype.aether.artifact.Artifact> resolve(org.sonatype.aether.artifact.Artifact root,
java.lang.String scope,
org.sonatype.aether.graph.DependencyFilter filter)
throws org.sonatype.aether.resolution.DependencyResolutionException
root - The artifact to work withscope - The scope to work with ("runtime", "test", etc.)filter - The dependency filter to work withorg.sonatype.aether.resolution.DependencyResolutionException - If can't fetch itprivate java.util.List<org.sonatype.aether.artifact.Artifact> fetch(org.sonatype.aether.RepositorySystemSession session,
org.sonatype.aether.resolution.DependencyRequest dreq)
throws org.sonatype.aether.resolution.DependencyResolutionException
session - The sessiondreq - Dependency requestorg.sonatype.aether.resolution.DependencyResolutionException - If can't fetch itprivate org.sonatype.aether.collection.CollectRequest request(org.sonatype.aether.graph.Dependency root)
root - The root to start withprivate static java.util.Collection<java.lang.String> reps(java.util.Collection<org.sonatype.aether.repository.RemoteRepository> repos)
repos - The list of themprivate org.sonatype.aether.RepositorySystemSession session()