This is a repackaged version of a bunch of Apache Maven dependencies, intended to offer a quick way to locate and download artifacts from the Maven central repository. It resolves all maven internal dependencies consistently and hides the existing library dependency problems from code that wants to download artifacts from the Maven repository system.
As most things Maven are simply a mess (and even internally inconsistent), this bundles up
- The Apache Maven resolver to locate artifacts
- File and HTTP transports
- Maven settings to load and interpret the local settings file
All the functionality is in the MavenArtifactLoader
class. See the javadoc for the class for more details.
Do a partial match:
MavenArtifactLoader loader = new MavenArtifactLoader();
List<String> results = loader.builder(GROUP_ID, ARTIFACT_ID)
.includeSnapshots(false)
.partialMatch("2.1")
.findAll();
Do an exact match:
MavenArtifactLoader loader = new MavenArtifactLoader();
Optional<String> result = loader.builder(GROUP_ID, ARTIFACT_ID)
.includeSnapshots(false)
.exactMatch("2.1.1")
.findBestMatch();
Find best semver match for a major version:
MavenArtifactLoader loader = new MavenArtifactLoader();
Optional<String> result = loader.builder(GROUP_ID, ARTIFACT_ID)
.includeSnapshots(false)
.semVerMajor(2)
.findBestMatch();
Find all matches for semver major and minor:
MavenArtifactLoader loader = new MavenArtifactLoader();
List<String> results = loader.builder(GROUP_ID, ARTIFACT_ID)
.includeSnapshots(false)
.semVerMinor(2, 1)
.findAll();
MavenArtifactLoader loader = new MavenArtifactLoader();
File artifactFile = loader.getArtifactFile(GROUP_ID, ARTIFACT_ID, "2.1.1");
(C) 2021-2023 Henning P. Schmiedehausen
Licensed under the Apache Software License V2.0