Package org.eclipse.aether.resolution
Class ArtifactResult
- java.lang.Object
-
- org.eclipse.aether.resolution.ArtifactResult
-
public final class ArtifactResult extends Object
The result of an artifact resolution request.
-
-
Constructor Summary
Constructors Constructor Description ArtifactResult(ArtifactRequest request)
Creates a new result for the specified request.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ArtifactResult
addException(Exception exception)
Records the specified exception while resolving the artifact.Artifact
getArtifact()
Gets the resolved artifact (if any).List<Exception>
getExceptions()
Gets the exceptions that occurred while resolving the artifact.ArtifactRepository
getRepository()
Gets the repository from which the artifact was eventually resolved.ArtifactRequest
getRequest()
Gets the resolution request that was made.boolean
isMissing()
Indicates whether the requested artifact is not present in any of the specified repositories.boolean
isResolved()
Indicates whether the requested artifact was resolved.ArtifactResult
setArtifact(Artifact artifact)
Sets the resolved artifact.ArtifactResult
setRepository(ArtifactRepository repository)
Sets the repository from which the artifact was resolved.String
toString()
-
-
-
Constructor Detail
-
ArtifactResult
public ArtifactResult(ArtifactRequest request)
Creates a new result for the specified request.- Parameters:
request
- The resolution request, must not benull
.
-
-
Method Detail
-
getRequest
public ArtifactRequest getRequest()
Gets the resolution request that was made.- Returns:
- The resolution request, never
null
.
-
getArtifact
public Artifact getArtifact()
Gets the resolved artifact (if any). UsegetExceptions()
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 benull
if the resolution failed.- Returns:
- This result for chaining, never
null
.
-
getExceptions
public List<Exception> 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:
isResolved()
-
addException
public ArtifactResult addException(Exception exception)
Records the specified exception while resolving the artifact.- Parameters:
exception
- The exception to record, may benull
.- Returns:
- This result for chaining, never
null
.
-
getRepository
public ArtifactRepository 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
public ArtifactResult setRepository(ArtifactRepository repository)
Sets the repository from which the artifact was resolved.- Parameters:
repository
- The repository from which the artifact was resolved, may benull
.- Returns:
- This result for chaining, never
null
.
-
isResolved
public boolean isResolved()
Indicates whether the requested artifact was resolved. Note that the artifact might have been successfully resolved despitegetExceptions()
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:
Artifact.getFile()
-
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.
-
-