Skip to content

Existing shading rules relocate the coursier.repositories system property. #477

Description

@Jacoby6000

Problem

I'm not sure if this is intentional or not, so this could be either a bug or a documentation task.

The JarJar Abrams plugin has a string heuristic that remaps strings that look like class names. coursier.repositories resembles a class name, so it gets remapped from coursier.repositories to coursierapi.shaded.coursier.repositories due to this shade rule.

The COURSIER_REPOSITORIES env var remains unchanged, of course.

I've been working on updating some of the builds at my place of work and this really threw me for a loop.

I think it would make sense to put forward some effort to retain the original coursier.repositories system property, for a few reasons.

  1. The relocation is undocumented
  2. coursier.repositories is easier to set/manage at runtime (like in SBT) than COURSIER_REPOSITORIES. Env vars cannot be set at runtime without some relaxing of newer JVM security constraints, and different platforms require different setup for this (see how sbt-dotenv does it for example). We can of course always just set "coursierapi.shaded.coursier.repositories" as well, it just seems a bit reundant.
  3. Users can reasonably derive most coursier repositories from sbt repository definitions, then set them as coursier.repositores, which would resolve weirdness around multiple different places using coursier's apis slightly differently.

Fix

If not intentional, this could be fixed with another rule that precedes the coursier.** rule.

A rename rule from "coursier.repositories" to "coursier.repositories" should resolve this for now.

I'm considering if it's worth the effort of making an upstream contribution to JarJar Abrams to provide a ban-list of exact strings that the shader should ignore.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions