Class MvnRepoLookup
- All Implemented Interfaces:
ResourceProvider
Depending on the request, this provider provides two types of resources.
-
The artifacts to be resolved as resources of type
MvnRepoDependency. The artifacts to be resolved are those added withresolve(java.lang.String...). Note that the result also includes theMvnRepoBoms added withbom(java.lang.String...). -
The resources of type
MvnRepoLibraryJarFilethat result from resolving the artifacts to be resolved.
The repositories used are those configured for all instances of this
provider by MavenContext and the repositories added with
addRepository(org.eclipse.aether.repository.RemoteRepository). Should there be no repositories configured, the
Maven Central repository will be added automatically.
Resolving is performed using Maven Resolver (formerly Eclipse Aether) version 2.x. Dependencies are collected from the specified artifacts after evaluating their effective Maven models, including any imported BOMs. Version conflicts are resolved using a "highest wins" strategy, i.e. the highest version of a dependency encountered in the dependency graph is selected. Note that this differs from Maven's default behavior which is "nearest wins".
Results of the dependency resolution are written to the log with log level FINE.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddRepository(String id, URI uri, MvnVersionType... supported) Add a repository that is to be used for the lookup.addRepository(org.eclipse.aether.repository.RemoteRepository repository) Add a repository that is to be used for the lookup.Add a bill of materials.protected <T extends Resource>
Collection<T> doProvide(ResourceRequest<T> request) Provide.downloadJavadoc(boolean enable) Whether to also download the javadoc.downloadSources(boolean enable) Whether to also download the sources.probe()Failing to resolve the dependencies normally results in aBuildException, because the requested artifacts are assumed to be required for the build.Add artifacts, specified by their coordinates (groupId:artifactId:version) as resources.resolve(Stream<? extends MvnRepoResource> resources) Add artifacts.Methods inherited from class AbstractProvider
context, name, of, rename, toString, vavrStreamMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ResourceProvider
resources
-
Constructor Details
-
MvnRepoLookup
public MvnRepoLookup()Initializes a new Maven repository lookup.
-
-
Method Details
-
addRepository
Add a repository that is to be used for the lookup.- Parameters:
repository- the repository- Returns:
- the mvn repo lookup
-
addRepository
Add a repository that is to be used for the lookup.- Parameters:
id- the repository iduri- the repository urisupported- the supported version types- Returns:
- the mvn repo lookup
-
bom
Add a bill of materials. The coordinates are resolved as a dependency with scopeimportwhich is added to thedependencyManagementsection when evaluating the effective model.- Parameters:
coordinates- the coordinates in the form groupId:artifactId:version- Returns:
- the mvn repo lookup
-
resolve
Add artifacts, specified by their coordinates (groupId:artifactId:version) as resources.- Parameters:
coordinates- the coordinates in the form groupId:artifactId:version- Returns:
- the mvn repo lookup
-
resolve
Add artifacts. The method handlesMvnRepoBoms correctly.- Parameters:
resources- the resources- Returns:
- the mvn repo lookup
-
probe
Failing to resolve the dependencies normally results in a
BuildException, because the requested artifacts are assumed to be required for the build.By invoking this method the provider enters probe mode and returns an empty result stream instead of throwing an exception if the resolution fails.
- Returns:
- the mvn repo lookup
-
downloadSources
Whether to also download the sources. Defaults totrue.- Parameters:
enable- the enable- Returns:
- the mvn repo lookup
-
downloadJavadoc
Whether to also download the javadoc. Defaults totrue.- Parameters:
enable- the enable- Returns:
- the mvn repo lookup
-
doProvide
Provide.- Specified by:
doProvidein classAbstractProvider- Type Parameters:
T- the generic type- Parameters:
request- the requested resources- Returns:
- the stream
-