Fork me on GitHub

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)

Alex Miller (Clojure team)04:01:56

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 - they are all slightly different), but they can all take an :aliases [:build] argument

Alex Miller (Clojure team)04:01:09

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 which I understand I need to doing something like 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


Can you pass it though, i.e., clojure -.ssl... -M:alias1:alias2....?


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`


Oooo! That works I was putting it in as a vector so that was the problem 😅


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


No, I don't believe there is any functionality for that.


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


I dont quite understand what does the latter mean exactly


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

  {: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

  {: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


I think it's being applied for me, ...


:local-dev {:extra-deps {local-dev/local-dev {:local/root "/home/david/.clojure/libs/" :deps/manifest :deps}}
              :jvm-opts [""]
              :main-opts ["-m" ""]}


So, I launched a Main, passing in jvm-opts, then used visualvm to confirm that the JVM had started with the -D set.


Thanks for your help! Let me look into it again :)


terminology question - why alias instead of profile


Because it aliases a piece of data with a name


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:

Alex Miller (Clojure team)20:01:48

This is the correct sense of it, tools.deps happens to be the most prominent user of this data

Alex Miller (Clojure team)20:01:55

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).

Alex Miller (Clojure team)03:01:42

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