This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-11-01
Channels
- # announcements (1)
- # aws (3)
- # beginners (150)
- # boot (12)
- # calva (7)
- # carry (3)
- # cider (1)
- # clara (51)
- # cljdoc (17)
- # cljs-dev (17)
- # cljsrn (1)
- # clojure (64)
- # clojure-austin (2)
- # clojure-india (1)
- # clojure-italy (10)
- # clojure-nl (4)
- # clojure-spec (42)
- # clojure-uk (63)
- # clojurescript (24)
- # core-async (23)
- # cursive (6)
- # datascript (7)
- # datomic (5)
- # figwheel-main (43)
- # fulcro (74)
- # hoplon (7)
- # kaocha (30)
- # leiningen (32)
- # mount (51)
- # nrepl (34)
- # off-topic (29)
- # re-frame (6)
- # reagent (10)
- # reitit (13)
- # shadow-cljs (66)
- # slack-help (3)
- # spacemacs (2)
- # specter (5)
- # sql (2)
- # tools-deps (51)
- # yada (13)
Say alias A says extra deps d1 d2, alias B says extra deps d3 d4, now I want to make an alias AB which combines A and B so it has extra deps d1 .. d4
Basically wondering if I could do something like https://github.com/borkdude/boot-bundle using deps.edn
@borkdude there's no inheritance. So the only way to do it is by modifying the edn file. I've been writing https://github.com/SevereOverfl0w/ednup with the goal of it eventually supporting this.
Say, I'm trying to figure out how to effectively deal with the .cpcache directory in circleci. The way it works is that circleci can store a directory in a cache which is then available to subsequent steps (although the subsequent steps might themselves run on different VM instances).
So what I currently do is run clojure -A:foo:bar -Spath
to download a bunch of stuff and then cache the .m2
and .cpcache
directories
My question is, will tools.deps create a single .cpcache entry for the combined :foo:bar
aliases, or will it create a :foo
cache and a :bar
cache? (Or all three?)
I'm wondering if it would be more efficient to run clojure -A:foo -Spath; clojure -A:bar -Spath
the cache key is based on the set of aliases used
Aha, makes sense. Thanks @alexmiller
https://github.com/clojure/brew-install/blob/1.9.0/src/main/resources/clojure#L230-L237
Hey, I'm migrating some lein project to deps.edn and somehow it looks like my dev/user.clj
isn't loaded in the repl, even though I use clj -R:dev
and the :dev
alias does have :extra-paths ["dev" "fixtures"]
. My user.clj
is very simple:
(:require
[com.stuartsierra.component.user-helpers :refer [dev go reset]]))
clj -Stree -R:dev
shows the component lib is loaded.
Still it's as if user.clj
isn't loaded:
$ clj -R:dev dev/user.clj
$
No output or error.
$ clj -R:dev
Clojure 1.9.0
user=> (dev)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: dev in this context, compiling:(NO_SOURCE_PATH:1:1)
user=>
What could I be missing?similar questions have come up a few times, it makes me wonder if there is a tutorial or documentation somewhere that is using -R in examples where it should be using -A
I think it must have been: https://clojure.org/guides/deps_and_cli#extra_deps
> You can add this dependency to your classpath by adding the :bench
alias to modify the dependency resolution: clj -R:bench
.
Ahh this should explain it: https://clojure.org/reference/deps_and_cli#_aliases
question about CI and .m2
- is there anything I have to do to set Clojure CLI on a machine for being able to cache artifacts in .m2
?
this machine does not seem to have Maven, do I need it? or .m2/settings.xml
if you are ci'ing inside some kind of container you might want to set things up so ~/.m2 is stored in a way that persists across different runs
is .m2
created for me?
ok thanks, my CI executes things in a weird way I think...every call to clojure
resets .m2
so it downloads everything again, investigating...
yeah, you are likely building in some kind of container environment with nothing persisted between builds
I am on Azure Pipeline..
yeah..
in theory that should be fine, m2 is a cache, so if the cache is missing it will just rebuild it, but it is much better to persist m2
yeah I see it is redownloading the whole thing
the clj tool fetches deps and builds the classpath once and sort of caches that, if the deps it fetches go missing, but the cache file it generates is still there, it will blow up
makes sense yeah
thank you so much
which command creates .m2
? I know first execution does, but I would like to see it there before running my actual other tasks
can I just do clojure -Sdescribe
?
actually let me try locally
yep that works
$ mv .m2 .m2-backup
$ clojure -Sdescribe
Downloading: org/clojure/clojure/1.10.0-alpha6/clojure-1.10.0-alpha6.pom from
Downloading: org/clojure/spec.alpha/0.2.168/spec.alpha-0.2.168.pom from
Downloading: org/clojure/pom.contrib/0.2.2/pom.contrib-0.2.2.pom from
Downloading: org/clojure/core.specs.alpha/0.2.36/core.specs.alpha-0.2.36.pom from
Downloading: org/clojure/clojure/1.10.0-alpha6/clojure-1.10.0-alpha6.jar from
Downloading: org/clojure/spec.alpha/0.2.168/spec.alpha-0.2.168.jar from
Downloading: org/clojure/core.specs.alpha/0.2.36/core.specs.alpha-0.2.36.jar from
{:version "1.9.0.397"
:config-files ["/home/arichiardi/.local/lib/clojure/deps.edn" "/home/arichiardi/.clojure/deps.edn" ]
:install-dir "/home/arichiardi/.local/lib/clojure"
:config-dir "/home/arichiardi/.clojure"
:cache-dir "/home/arichiardi/.clojure/.cpcache"
:force false
:repro false
:resolve-aliases ""
:classpath-aliases ""
:jvm-aliases ""
:main-aliases ""
:all-aliases ""}
$ ll ~/.m2
total 24
drwxrwxr-x 3 arichiardi arichiardi 4096 Nov 1 12:45 ./
drwxr-xr-x 120 arichiardi arichiardi 16384 Nov 1 12:45 ../
drwxrwxr-x 3 arichiardi arichiardi 4096 Nov 1 12:45 repository/
it is downloading alpha6
by default
No, it’s not - that’s an artifact of your deps.edn files
By default, clj will use 1.9.0 based on the ~/.clojure/deps.edn
I should have use -Srepo
maybe?
another question I have is if I can have aliases in parent dir and consume in children dir, in a monorepo setup for instance
I tried with CLJ_CONFIG
to the root but I don't see it working...
oh now I see it working cool