bazel_maven_repository icon indicating copy to clipboard operation
bazel_maven_repository copied to clipboard

Support an alias configuration for artifacts

Open cgruber opened this issue 6 years ago • 1 comments

Presently artifacts are named for their artifactId (possibly munged). However, this is sometimes inconvenient, as in the case of something like hamcrest-core or assertj-core. There should be a way to specify an alias target with a different name, which will pass-through to the default target.

The alias should be publicly visible, and the mvn_jvm_import should be reduced in visibility to //visibility:@maven//__subpackages__ (generated with the appropriate workspace name in place of maven). This allows existing inter-dependencies logic to work unmodified, but the public alias will be the means by which deps not in the maven workspace reference this artifact.

e.g.:

maven_repository_specification(
    name = "maven",
    artifacts = {
        "org.mockito:mockito-core:2.7.5": { "sha256": "blah", "alias" = "mockito" }
    },
)

This would generate

alias(name = "mockito", actual = ":mockito_core")

maven_jvm_artifact(
    name = "mockito_core",
    artifact = "org.mockito:mockito-core:2.7.5",
    visibility = "//visibility:@maven//__subpackages__",
    deps = [
        "@maven//net/bytebuddy:byte_buddy",
        "@maven//net/bytebuddy:byte_buddy_agent",
        "@maven//org/objenesis",
    ]
)

Implements part of #52

cgruber avatar Feb 28 '19 21:02 cgruber

Implements part of #52

cgruber avatar Jun 18 '19 22:06 cgruber