Class ArtifactResult

java.lang.Object
org.eclipse.aether.resolution.ArtifactResult

public final class ArtifactResult extends Object
The result of an artifact resolution request.
See Also:
  • Field Details

    • NO_REPOSITORY

      public static final ArtifactRepository NO_REPOSITORY
      A sentinel object, that is used as key for exceptions that had no related repository during resolution.
      Since:
      2.0.0
  • Constructor Details

    • ArtifactResult

      Creates a new result for the specified request.
      Parameters:
      request - The resolution request, must not be null.
  • Method Details

    • getRequest

      Gets the resolution request that was made.
      Returns:
      The resolution request, never null.
    • getArtifact

      Gets the resolved artifact (if any). Use getExceptions() to query the errors that occurred while trying to resolve the artifact.
      Returns:
      The resolved artifact or null if the resolution failed.
    • setArtifact

      public ArtifactResult setArtifact(Artifact artifact)
      Sets the resolved artifact.
      Parameters:
      artifact - The resolved artifact, may be null if the resolution failed.
      Returns:
      This result for chaining, never null.
    • getExceptions

      Gets the exceptions that occurred while resolving the artifact. Note that this list can be non-empty even if the artifact was successfully resolved, e.g. when one of the contacted remote repositories didn't contain the artifact but a later repository eventually contained it.
      Returns:
      The exceptions that occurred, never null.
      See Also:
    • getMappedExceptions

      Gets the exceptions that occurred while resolving the artifact. Note that this map can be non-empty even if the artifact was successfully resolved, e.g. when one of the contacted remote repositories didn't contain the artifact but a later repository eventually contained it.
      Returns:
      Map of exceptions per repository, that occurred during resolution, never null.
      Since:
      2.0.0
      See Also:
    • addException

      Deprecated.
      Records the specified exception while resolving the artifact.
      Parameters:
      exception - The exception to record, may be null.
      Returns:
      This result for chaining, never null.
    • addException

      public ArtifactResult addException(ArtifactRepository repository, Exception exception)
      Records the specified exception while resolving the artifact.
      Parameters:
      exception - The exception to record, may be null.
      Returns:
      This result for chaining, never null.
      Since:
      2.0.0
    • getRepository

      Gets the repository from which the artifact was eventually resolved. Note that successive resolutions of the same artifact might yield different results if the employed local repository does not track the origin of an artifact.
      Returns:
      The repository from which the artifact was resolved or null if unknown.
    • setRepository

      Sets the repository from which the artifact was resolved.
      Parameters:
      repository - The repository from which the artifact was resolved, may be null.
      Returns:
      This result for chaining, never null.
    • getLocalArtifactResult

      Gets the LocalArtifactResult received during artifact resolution.
      Returns:
      The LocalArtifactResult or null.
      Since:
      1.9.6
    • setLocalArtifactResult

      public void setLocalArtifactResult(LocalArtifactResult localArtifactResult)
      Sets the LocalArtifactResult that is received during artifact resolution.
      Parameters:
      localArtifactResult - The local artifact result.
      Since:
      1.9.6
    • isResolved

      public boolean isResolved()
      Indicates whether the requested artifact was resolved. Note that the artifact might have been successfully resolved despite getExceptions() indicating transfer errors while trying to fetch the artifact from some of the specified remote repositories.
      Returns:
      true if the artifact was resolved, false otherwise.
      See Also:
    • isMissing

      public boolean isMissing()
      Indicates whether the requested artifact is not present in any of the specified repositories.
      Returns:
      true if the artifact is not present in any repository, false otherwise.
    • toString

      public String toString()
      Overrides:
      toString in class Object