Interface MavenVersionsResolver
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
SignedVersionResolverWrapper
SPI Interface implemented by tooling doing the Maven request to get all the versions for the given artifact.
A client of this library is responsible for implementation
MavenVersionsResolver to query Maven for all the versions for a given Artifact.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceFactory API to build MavenVersionResolver. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()getAllVersions(String groupId, String artifactId, String extension, String classifier) Returns all the versions provided by Maven for the given artifact.getMetadataLatestVersion(String groupId, String artifactId) Returns the<latest>version according to the repositories' Maven metadata.getMetadataReleaseVersion(String groupId, String artifactId) Returns the<release>version according to the repositories' Maven metadata.resolveArtifact(String groupId, String artifactId, String extension, String classifier, String version) Resolve the maven artifact based on the full coordinates.resolveArtifacts(List<ArtifactCoordinate> coordinates) Resolve a list of maven artifacts based on the full coordinates.resolveChannelMetadata(List<? extends ChannelMetadataCoordinate> manifestCoords) Resolve a list of channel metadata artifacts based on the coordinates.
-
Method Details
-
getAllVersions
Returns all the versions provided by Maven for the given artifact.- Parameters:
groupId- Maven GroupId - requiredartifactId- Maven ArtifactId - requiredextension- Maven extension - can benullclassifier- Maven classifier - can benull- Returns:
- the set of versions.
-
resolveArtifact
File resolveArtifact(String groupId, String artifactId, String extension, String classifier, String version) throws ArtifactTransferException Resolve the maven artifact based on the full coordinates.- Parameters:
groupId- Maven GroupId - requiredartifactId- Maven ArtifactId - requiredextension- Maven extension - can benullclassifier- Maven classifier - can benullversion- Maven version - required- Returns:
- a File representing the resolved Maven artifact.
- Throws:
ArtifactTransferException- if the artifact can not be resolved.
-
resolveArtifacts
Resolve a list of maven artifacts based on the full coordinates. The order of returned Files is the same as order of coordinates.- Parameters:
coordinates- - list of ArtifactCoordinates. They need contain at least groupId, artifactId and version.- Returns:
- a list of File representing the resolved Maven artifact.
- Throws:
ArtifactTransferException- if any artifacts can not be resolved.
-
resolveChannelMetadata
List<URL> resolveChannelMetadata(List<? extends ChannelMetadataCoordinate> manifestCoords) throws ArtifactTransferException Resolve a list of channel metadata artifacts based on the coordinates. If theChannelMetadataCoordinatecontains non-null URL, that URL is returned. If theChannelMetadataCoordinatecontains non-null Maven coordinates, the Maven artifact will be resolved and a URL to it will be returned. If the Maven coordinates specify only groupId and artifactId, latest available version of matching Maven artifact will be resolved. The order of returned URLs is the same as order of coordinates.- Parameters:
manifestCoords- - list of ChannelMetadataCoordinate.- Returns:
- a list of URLs to the metadata files
- Throws:
ArtifactTransferException- if any artifacts can not be resolved.
-
getMetadataReleaseVersion
Returns the<release>version according to the repositories' Maven metadata. If multiple repositories contain the same artifact,VersionMatcher.COMPARATORis used to choose version.- Parameters:
groupId- Maven GroupId - requiredartifactId- Maven ArtifactId - required- Returns:
- the
releaseversion. - Throws:
UnresolvedMavenArtifactException- if the metadata can not be resolved or is incomplete.
-
getMetadataLatestVersion
Returns the<latest>version according to the repositories' Maven metadata. If multiple repositories contain the same artifact,VersionMatcher.COMPARATORis used to choose version.- Parameters:
groupId- Maven GroupId - requiredartifactId- Maven ArtifactId - required- Returns:
- the
latestversion. - Throws:
UnresolvedMavenArtifactException- if the metadata can not be resolved or is incomplete.
-
close
default void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-