archive.maven

Install/Resolve archives to/from Maven repositories

An extension for instrumental.archive, providing access to Maven repositories, with artifacts as Archives.

Provides:

  • Configurable local and remote repositories
  • Download from remote repositories
  • Configure a (real) local repository as a remote
  • Install to local repositories (for later resolution)
  • Resolve dependency graphs (download with transitive dependencies)
  • Build classpaths

Use to:

  • Provide compilation dependencies for instrumental.compile
  • Extract compilation sourcecode for instrumental.compile
  • Maintain dependency graph information for dynamically created archives
  • Meddle with your local Maven repository
  • Build uber/shaded JARs programmatically

Dependency Graph

Module Dependency

Examples

Download a dependency graph and make available as a Map of maven artifact GAV coordinate to instrumental Archive.

	Map<MavenArtifact, Archive> dependencies = maven()
			.usingCentral()
			.usingLocal(Paths.get(".", "target", "repo-resolve-depgraph"))
			.dependencies("junit:junit:4.12");

	MavenArtifact junit = new MavenArtifact("junit", "junit", "4.12", "jar", "");
	MavenArtifact hamcrest = new MavenArtifact("org.hamcrest", "hamcrest-core", "1.3", "jar", "");

	assertThat(dependencies, allOf(
			aMapWithSize(2),
			hasKey(junit),
			hasKey(hamcrest)));

Download a dependency graph and make available as a classpath.

	List<String> classpath = maven()
			.usingCentral()
			.usingLocal(Paths.get(".", "target", "repo-resolve-classpath"))
			.classpath("junit:junit:4.12")
			.stream()
			.map(Object::toString)
			.collect(toList());

	assertThat(classpath, containsInAnyOrder(
			endsWith("junit-4.12.jar"),
			endsWith("hamcrest-core-1.3.jar")));

(source).



Back to top

Version: 0.1.0. Last Published: 2018-10-08.

Earcam Maven Skin.