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 Details

    • log

      private static final org.slf4j.Logger log
    • mavenSession

      private final org.apache.maven.execution.MavenSession mavenSession
    • aetherMapper

      private final AetherArtifactMapper aetherMapper
    • aetherDependencyManagement

      private final AetherDependencyManagement aetherDependencyManagement
    • aetherResolver

      private final AetherResolver aetherResolver
  • Constructor Details

    • AetherMavenArtifactPathResolver

      @Inject AetherMavenArtifactPathResolver(org.apache.maven.execution.MavenSession mavenSession, org.eclipse.aether.RepositorySystem repositorySystem)
  • Method Details

    • resolveArtifact

      public Path resolveArtifact(MavenArtifact mavenArtifact) throws ResolutionException
      Description copied from interface: MavenArtifactPathResolver
      Resolve a single Maven artifact directly, and do not resolve any transitive dependencies.
      Specified by:
      resolveArtifact in interface MavenArtifactPathResolver
      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 interface MavenArtifactPathResolver
      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 - if false, 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.