This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-03-16
Channels
- # atlanta-clojurians (8)
- # beginners (103)
- # boot (22)
- # boot-dev (1)
- # cider (36)
- # cljs-dev (55)
- # cljsrn (3)
- # clojars (25)
- # clojure (104)
- # clojure-brasil (1)
- # clojure-dusseldorf (2)
- # clojure-italy (8)
- # clojure-norway (9)
- # clojure-russia (15)
- # clojure-spec (6)
- # clojure-uk (26)
- # clojurescript (246)
- # cursive (26)
- # data-science (1)
- # datomic (22)
- # dirac (11)
- # editors (1)
- # emacs (8)
- # fulcro (50)
- # graphql (11)
- # hoplon (1)
- # jobs-discuss (27)
- # leiningen (44)
- # luminus (33)
- # lumo (2)
- # mount (1)
- # off-topic (8)
- # onyx (5)
- # parinfer (4)
- # reagent (94)
- # ring-swagger (14)
- # shadow-cljs (37)
- # spacemacs (10)
- # specter (3)
- # tools-deps (4)
- # unrepl (14)
- # yada (5)
I seem to be having an issue with lein including some unwanted dependencies into my classpath. For example, in my project.clj I’ve got :source-paths
set to ["src"]
and lein classpath
includes my test directory in there. My test profile does have :source-paths
as ["src" "test"]
, but even a lein with-profile -test classpath
I’m still seeing the test directory in the classpath. Any ideas why this might be happening?
@colindresj do you have it in your :dev
profile as well?
Really, do you have it coming from any of these other default profiles
[:base :system :user :provided :dev]
mentioned in https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md#default-profiles
I don’t have it in :dev
or :user
, and haven’t specified any of the others
Even doing lein with-profile -base,-system,-user,-provided,-dev classpath | tr ":" "\n"
gives me something I don’t expect (including my test dir still being there)
Just asked a coworker to do the same and it’s happening for him as well
@colindresj just for completeness, perhaps make a profile, called :trial
like
:trial {:source-paths ^:replace ["src"]}
then
lein with-profile trial classpath
Here’s the first couple lines of my output @mikerod
@colindresj that’s with doing a profile like I mentioned above?
That’s possible
I actually ran into this because a different tool is using the output of lein classpath
and I was getting some weird results, so I started digging
Basically end up in this
(defn get-classpath
"Return the classpath for project as a list of strings."
[project]
(for [path (concat (:test-paths project)
(:source-paths project)
(:resource-paths project)
[(:compile-path project)]
(checkout-deps-paths project)
(for [dep (resolve-managed-dependencies
:dependencies :managed-dependencies project)]
(.getAbsolutePath dep)))
:when path]
(normalize-path (:root project) path)))
Let me check
if you make a profile like :trial
and put :test-paths ^:replace []
I think, that may help
Still may have to consider if you are using lein checkouts too though, since those may interfere as well
Replacing :test-paths
fixes it for me
I don’t have :test-paths
set in this project.clj, but I also have checkouts, so I’ll look through those
You may be able to squash checkouts with :checkout-deps-shares ^:replace []
in a profile too , but I’d have to experiment with that
That gives me a much smaller classpath, but still have test in there with :checkout-deps-shares ^:replace []
Maybe it’s a plugin that’s doing something with :test-paths
?
Either way, I’m good for now just replacing :test-paths
on a particular profile. Thanks @mikerod
Seems like a few lein built in tasks would be nicer if they could give you a classpath/deps tree etc that is representative of the “production build”
Yeah for sure
I’ve found using lein-cprint or lein-pprint really helpful debugging stuff like the above - you can do lein cprint :checkout-deps-shares
to see the default, or lein with-profile uberjar cprint :checkout-deps-shares
, etc.
Ah, very helpful @greg316
Thanks