Fork me on GitHub
#leiningen
<
2020-12-23
>
Ben Sless16:12:51

How do I prevent dev profiles dependencies from being pulled into the pom? I have something like

:profiles
  {:test-build {:main foo.bench
                :aot :all}
   :dev
   [:bench :prof :cli
    {:source-paths ["analysis"]
     :dependencies
     [[incanter "1.9.3"]]}]
   :cli {:dependencies [[org.clojure/tools.cli "0.4.2"]]}
   :bench {:source-paths ["bench"]
           :dependencies [[criterium "0.4.5" :scope "provided"]
                          [org.clojure/test.check "0.9.0"]]}
   :prof {:source-paths ["prof"]
          :dependencies [[com.clojure-goes-fast/clj-async-profiler "0.4.0"]]}}
but when I run lein pom those deps are added. another project requires this one and builds an uberjar it will also pull in the dev dependencies. A workaround I found is marking them as provided but that doesn't seem like the right solution, more like abusing a feature

dpsutton16:12:45

i think you can do with-profiles -dev. ideally you could do with-profile release without a plus or minus to dictate the single profile. there are a few that default if i remember correctly

Ben Sless16:12:19

Isn't it weird that a pom would pull dev dependencies in? looks like a bug

dpsutton16:12:28

i think running lein pulls in default profiles. i agree that individual tasks should not do this but it happens at the top level before knowing what the task is i bet

Ben Sless17:12:11

It seems weird enough to open a ticket imo. I'll use -dev in the meanwhile, thanks 🙂

dpsutton17:12:46

be aware there are still a few other profiles by default i think.

Ben Sless17:12:18

looking at the profiles documentation now: In order to prevent profile settings from being propagated to other projects that depend upon yours, the `:default` profiles are removed from your project when generating the pom, jar, and uberjar, and an `:uberjar` profile, if present, is included when creating uberjars. (This can be useful if you want to specify a `:main` namespace for uberjar use without triggering AOT during regular development.) Profiles activated through an explicit `with-profile` invocation will be preserved.

Ben Sless17:12:02

From that I gather it should not be included :thinking_face:

dpsutton17:12:54

what version? might be a regression

Ben Sless17:12:30

downgraded all the way to 2.9.0, found in every version hence

Ben Sless17:12:15

even in 2.7.1

Ben Sless17:12:14

wait, no, tested badly, works well in 2.7.1

Ben Sless17:12:45

works in 2.8.3

Ben Sless17:12:40

aha! regression in 2.9.2