Class AetherMavenArtifactPathResolver
java.lang.Object
io.github.ascopes.protobufmavenplugin.dependencies.aether.AetherMavenArtifactPathResolver
- All Implemented Interfaces:
MavenArtifactPathResolver
@Description("Integrates with Eclipse Aether to resolve and download dependencies locally")
@Named
final class AetherMavenArtifactPathResolver
extends Object
implements MavenArtifactPathResolver
Implementation of
MavenArtifactPathResolver
that integrates with the Eclipse Aether
artifact resolution backend provided by Eclipse for Apache Maven.- Since:
- 2.4.4, many iterations of this existed in the past with different names.
- Author:
- Ashley Scopes
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AetherDependencyManagement
private final AetherArtifactMapper
private final AetherResolver
private static final org.slf4j.Logger
private final org.apache.maven.execution.MavenSession
-
Constructor Summary
ConstructorsConstructorDescriptionAetherMavenArtifactPathResolver
(org.apache.maven.execution.MavenSession mavenSession, org.eclipse.aether.RepositorySystem repositorySystem) -
Method Summary
Modifier and TypeMethodDescriptionresolveArtifact
(MavenArtifact mavenArtifact) Resolve a single Maven artifact directly, and do not resolve any transitive dependencies.resolveDependencies
(Collection<? extends MavenArtifact> artifacts, DependencyResolutionDepth defaultDepth, Set<String> dependencyScopes, boolean includeProjectArtifacts, boolean failOnInvalidDependencies) Resolve all given dependencies based on their resolution depth semantics.
-
Field Details
-
log
private static final org.slf4j.Logger log -
mavenSession
private final org.apache.maven.execution.MavenSession mavenSession -
aetherMapper
-
aetherDependencyManagement
-
aetherResolver
-
-
Constructor Details
-
AetherMavenArtifactPathResolver
@Inject AetherMavenArtifactPathResolver(org.apache.maven.execution.MavenSession mavenSession, org.eclipse.aether.RepositorySystem repositorySystem)
-
-
Method Details
-
resolveArtifact
Description copied from interface:MavenArtifactPathResolver
Resolve a single Maven artifact directly, and do not resolve any transitive dependencies.- Specified by:
resolveArtifact
in interfaceMavenArtifactPathResolver
- Parameters:
mavenArtifact
- the artifact to resolve.- Returns:
- the path to the resolved artifact.
- Throws:
ResolutionException
- if resolution fails in the backend.
-
resolveDependencies
public List<Path> resolveDependencies(Collection<? extends MavenArtifact> artifacts, DependencyResolutionDepth defaultDepth, Set<String> dependencyScopes, boolean includeProjectArtifacts, boolean failOnInvalidDependencies) throws ResolutionException Description copied from interface:MavenArtifactPathResolver
Resolve all given dependencies based on their resolution depth semantics.- Specified by:
resolveDependencies
in interfaceMavenArtifactPathResolver
- Parameters:
artifacts
- the artifacts to resolve.defaultDepth
- the project default dependency resolution depth.dependencyScopes
- the allowed dependency scopes to resolve.includeProjectArtifacts
- whether to also resolve project dependencies and return them in the result.failOnInvalidDependencies
- iffalse
, resolution of invalid dependencies will result in errors being logged, but the build will not be halted.- Returns:
- the paths to each resolved artifact.
- Throws:
ResolutionException
- if resolution failed in the backend.
-