Skip to content

build.sbt: Resolver.mavenLocal makes the sbt build fragile to stale ~/.m2 cache state #1874

Closed

Description

@jaceklaskowski

Problem

build.sbt adds Resolver.mavenLocal in commonSettings (build.sbt:76), applied broadly across modules including hadoop and spark.

This makes build/sbt compile fragile to the state of the machine's ~/.m2/repository, which is not a transactional download cache the way coursier's or Ivy's caches are. Plain Maven (or an IDE indexing dependencies, or an interrupted/Ctrl+C'd download) can leave a .pom file cached locally without the corresponding .jar. Once that happens, sbt/coursier resolves that module's metadata from mavenLocal and does not fall back to Maven Central for the actual jar — it fails the build with a NotFound fetch error, e.g.:

[error] lmcoursier.internal.shaded.coursier.error.FetchError$DownloadingArtifacts: Error fetching artifacts:
[error] file:/Users/x/.m2/repository/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar: not found: ...

This is unrelated to the actual dependency being genuinely available (Maven Central serves it fine) — it's purely an artifact of ~/.m2 state accumulated by unrelated tools/projects over time, yet it breaks the Unity Catalog build.

On one dev machine, this surfaced as 176 artifacts across the whole ~/.m2 cache having POM-only entries (no jar), which repeatedly broke hadoop and spark module compilation until manually repaired by re-fetching the missing jars from Maven Central.

Request

Investigate why Resolver.mavenLocal is needed (likely so hadoop/spark connector modules can pick up locally publishLocal'd Unity Catalog artifacts during development) and consider:

  • Removing it if it's not actually required for the default compile/test/package tasks, or
  • Scoping it to a narrower/opt-in context (e.g. only active under a local-dev sbt profile or a specific task) instead of applying it to commonSettings broadly, or
  • At minimum, documenting the fragility in CONTRIBUTING.md / README build section so contributors know how to diagnose a FetchError$DownloadingArtifacts failure against ~/.m2 quickly (find POM-only entries, re-download the missing jar).

Environment

  • Unity Catalog v0.6.0 branch
  • build/sbt clean compile
  • macOS, local ~/.m2/repository shared across multiple unrelated projects/IDEs over time

Activity

  1. jaceklaskowski commented on Sep 13, 2026

    @jaceklaskowski
    ContributorAuthor

    This is a script to clean up ~/.m2 from orphaned POMs:

    find ~/.m2/repository -name "*.pom" | while read p; do
      d=$(dirname "$p"); b=$(basename "$p" .pom)
      [ -f "$d/$b.jar" ] || grep -q "<packaging>pom</packaging>" "$p" || echo "$d/$b"
    done

    Run this occasionally, or after any interrupted build, and re-fetch what it lists.

  2. added a commit that references this issue on Oct 25, 2026
    ad7f5a7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions