Skip to content

build: restore <scope>provided</scope> on Clojure + CLJS deps (rf2-6i657) - #6

Merged
mike-thompson-day8 merged 1 commit into
masterfrom
mvn-scope-fix
May 13, 2026
Merged

mike-thompson-day8 merged 1 commit into
masterfrom
mvn-scope-fix

Conversation

@mike-thompson-day8

Copy link
Copy Markdown
Contributor

Summary

After the lein → tools.build swap (rf2-ucbuz), the emitted pom.xml listed org.clojure/clojure and org.clojure/clojurescript as ordinary (non-provided) dependencies. The legacy project.clj had :scope \"provided\" on these so consumers wouldn't transitively pull a specific Clojure/CLJS version.

Root cause: clojure.tools.build.tasks.write-pom/to-dep (as of v0.10.13) only honors :exclusions and :optional — it silently drops :mvn/scope. So adding :mvn/scope \"provided\" to deps.edn wouldn't help.

Fix

Post-process the emitted pom.xml in build.clj's jar fn between write-pom and copy-dir. A small regex finds the <dependency> blocks for org.clojure/clojure and org.clojure/clojurescript and injects <scope>provided</scope> before the closing </dependency> tag. Throws if the format unexpectedly changes (so we notice on the next tools.build bump rather than silently regressing).

No version bump — 0.3.0 is already tagged and the deploy hadn't yet completed (awaiting Clojars secrets). The next release (0.3.1 or whatever) picks this up.

Test plan

  • clojure -T:build jar succeeds locally.
  • unzip -p target/de-dupe-0.3.0.jar META-INF/maven/day8/de-dupe/pom.xml | grep -B 1 -A 1 scope shows <scope>provided</scope> on both Clojure entries:
    <version>1.12.4</version>
    <scope>provided</scope>
    </dependency>
    --
    <version>1.11.132</version>
    <scope>provided</scope>
    </dependency>
    

@mike-thompson-day8
mike-thompson-day8 merged commit 381a89f into master May 13, 2026
2 checks passed
@mike-thompson-day8
mike-thompson-day8 deleted the mvn-scope-fix branch May 13, 2026 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant