This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-17
Channels
- # announcements (24)
- # babashka (22)
- # beginners (49)
- # cider (16)
- # clj-kondo (8)
- # cljsrn (4)
- # clojure (87)
- # clojure-australia (7)
- # clojure-europe (44)
- # clojure-nl (4)
- # clojure-sweden (7)
- # clojure-uk (24)
- # clojurescript (5)
- # core-async (7)
- # cryogen (8)
- # cursive (22)
- # data-oriented-programming (2)
- # datomic (1)
- # emacs (6)
- # events (4)
- # fulcro (11)
- # google-cloud (1)
- # introduce-yourself (1)
- # java (8)
- # jobs (3)
- # lsp (10)
- # observability (1)
- # off-topic (12)
- # polylith (12)
- # re-frame (6)
- # reitit (36)
- # remote-jobs (1)
- # ring (4)
- # ring-swagger (1)
- # rum (4)
- # schema (1)
- # shadow-cljs (18)
- # sql (56)
- # tools-deps (33)
If i have a deps.edn that looks like this
{:deps {a/b {...}}
:aliases {:build {:deps {c/d {...}}}}}
Is there a way to create a basis that just has the deps from the build alias, and not a/b
(to my understanding this is what clj -T …
does)yes, but it will not be identical to -T without a small bit of modification.
not sure which api you're using to create the basis (`tools.deps.alpha/create-basis`, tools.cli.api/basis
, or tools.build.api/create-basis
- they are all slightly different), but they can all take an :aliases [:build]
argument
the one difference from -T is that -T adds "."
to the :paths
. you can either make this explicit by putting it in the :build
alias :paths
, or you can also pass a :extra {:paths ["."]}
to any of those api calls above too
and it turns out the reason i was so confused is that i was passing the aliases as strings, which resolved to nothing, and then i saw the root classpath
Is there a way I can add a truststore as a JVM parameter? In deps.edn? Am getting sun.security.validator.ValidatorException which I understand I need to doing something like -Djavac.net.ssl.trustStore=....
but I'm not sure how to go about it for deps edn cause previously when using lein I could set my env var of JVM_OPTS
For example, I have an shell alias that starts up clojure in debug...`clojure -J-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 -J-Dclojure.core.async.go-checking=true -M:foo:bar`
But now I need to make sure it integrates the editors my team uses :x the jvm-opts part that is
@dharrigan do you know of anyway to get configure deps.edn apply the jvm-opts based on an env variable etc
Like doing "${SOME_ENV}"
in the deps.edn? If so, no, I don't believe the deps.edn is run through any shell expansion.
Hmmm more like how lein would use JVM-OPTS
and apply that to whatever java command is ran when running lein
I'm reading the reference docs and might this be what I want? JVM arguments may either be passed on the command line (with -J) or by using data stored in an alias under :jvm-opts and passed with -X or -A or -M
The first example is the one I gave above, i.e., to pass in the JVM parameters as the clj process is created, the second option, here is an example
The part I don't quite understand is that
:repl/nrepl
{:extra-deps {nrepl/nrepl {:mvn/version "0.9.0"}}
:main-opts ["-m" "nrepl.cmdline"]}
This works when I do clojure -J-Djavax.... -M:repl/nrepl
But when I modify it
:repl/nrepl
{:extra-deps {nrepl/nrepl {:mvn/version "0.9.0"}}
:jvm-opts ...
:main-opts ["-m" "nrepl.cmdline"]}
clojure -M repl/nrepl
doesn't work. It seems like the jvm-opts isn't being applied:local-dev {:extra-deps {local-dev/local-dev {:local/root "/home/david/.clojure/libs/local.dev" :deps/manifest :deps}}
:jvm-opts ["-Djavax.net.ssl.trustStore=/home/david/foo"]
:main-opts ["-m" "local.dev.main"]}
So, I launched a Main, passing in jvm-opts, then used visualvm to confirm that the JVM had started with the -D
set.
I remember hearing a sentiment from @U064X3EF3 that aliases might contain completely arbitrary data that can be passed to clojure programs
It seems there isn't much support for that now, but maybe it's coming? :thinking_face:
This is the correct sense of it, tools.deps happens to be the most prominent user of this data
Support for this is partially there, more to come
While building a -T:tool
style tool, I also wondered about whether users would expect a tool's config map to be passed as an alias - I ended up just reading the config from a seperate .edn file. If I needed different configurations for different "profiles", there didn't seem to be a way to use the cli to select one of them ( clojure -T:tool -A:config2
or something like that).
It is kind of possible now by reading the injected basis, but I think this is an area where more could be done by referencing aliases