tools-deps

Discuss tools.deps.alpha, tools.build, and the clj/clojure command-line scripts! See also #depstar #clj-new
nnichols 2021-01-04T18:19:56.199900Z

For posterity, I created the two following aliases:

:jar     {:extra-deps {seancorfield/depstar {:mvn/version "2.0.165"}}
                     :exec-fn    hf.depstar/uberjar
                     :exec-args  {:jar        "my-lib.jar"
                                  :aot        true
                                  :main-class my-lib.core}}
and
:deploy  {:extra-deps    {slipset/deps-deploy {:git/url "<https://github.com/Swirrl/deps-deploy.git>"
                                                          :sha     "588e4b96b33820a6ee1e35663410450ccb876b30"}}
                     :override-deps {s3-wagon-private/s3-wagon-private {:mvn/version "1.3.2"}}
                     :exec-fn       deps-deploy.deps-deploy/deploy
                     :exec-args     {:repository {"releases" {:url "<s3p://my-s3-route/releases/>"}}
                                     :artifact   "my-lib.jar"
                                     :installer  :remote}}

hanDerPeder 2021-01-04T19:52:51.200800Z

can I add :jvm-opts without adding it in an alias?

borkdude 2021-01-04T19:53:12.201Z

I don't think that works

hanDerPeder 2021-01-04T19:54:10.201900Z

I donโ€™t know the internals of tools-deps. Does that make sense? Coming from leiningen it seems like a strange omission.

vlaaad 2021-01-04T20:26:40.202400Z

-J

vlaaad 2021-01-04T20:29:33.203800Z

You can add jvm opts at the point of invocation with clj -J... , but not in deps.edn file

seancorfield 2021-01-04T20:44:13.204200Z

@peder.refsnes You can vote for it here: https://ask.clojure.org/index.php/7834/support-default-jvm-opts

1๐Ÿ‘
alexmiller 2021-01-04T20:53:47.204700Z

I continue to feel this is weirdly at odds with using tools

alexmiller 2021-01-04T20:54:03.205Z

and I'm going to continue not implementing it until that makes sense :)

seancorfield 2021-01-04T21:01:49.205800Z

Yeah, I don't see much of a use case for it either. I have only ever needed to set JVM options for a specific task, which means a specific alias.

seancorfield 2021-01-04T21:02:23.206500Z

But people do keep asking for it, so hopefully someone will come up with a justification for it that is convincing... ๐Ÿ™‚

seancorfield 2021-01-04T21:04:20.207500Z

(and "leiningen supports it" isn't at all convincing to me ๐Ÿ™‚ leiningen does a lot of things that I don't think are necessarily good ideas)

alexmiller 2021-01-04T21:13:41.209200Z

I do actually get the use case, it's just that's not the only use case

seancorfield 2021-01-04T21:17:22.210100Z

What sort of JVM options can you imagine folks wanting to set for all operations in a deps.edn project? I'm curious...

alexmiller 2021-01-04T21:18:13.210400Z

well the use case is where "all" is the two things you usually do

alexmiller 2021-01-04T21:19:10.211100Z

and you "always" want to do something like set a system property for your app or a particular garbage collector or whatever

alexmiller 2021-01-04T21:20:17.211600Z

I think in some cases "all" is really "when I run my repl I want default stuff to be set"

alexmiller 2021-01-04T21:21:01.212800Z

that is in particular an interesting case where having a "default" alias might be useful

alexmiller 2021-01-04T21:22:48.213900Z

not too different than leiningen :default profile really

hanDerPeder 2021-01-04T21:40:16.215900Z

My current (and only) reason for wanting this is for playing around with Dragan Djurics ML libraries. Seems it needs a workaround for java 9+. https://github.com/uncomplicate/neanderthal/blob/master/examples/hello-world/project.clj#L11-L12

alexmiller 2021-01-04T21:44:27.218200Z

Which you could put in an alias, you just need to remember to use it then

hanDerPeder 2021-01-04T21:46:37.219700Z

Indeed, but itโ€™s annoying when you forget ๐Ÿ™‚ Iโ€™m all for features carrying their weight, just thought Iโ€™d ask.

seancorfield 2021-01-04T21:54:51.221900Z

I think I would have a :run alias for running the app so it's just clojure -M:run and perhaps a :dev alias for running a REPL and just live with the duplication of :jvm-opts...

vlaaad 2021-01-04T21:56:27.222500Z

I find lein's default profiles confusing, it's always hard to tell what's enabled/on the classpath

seancorfield 2021-01-04T21:57:04.223Z

Indeed. Leiningen's "helpfulness" is one of the things I always liked the least about it.

1โž•
hanDerPeder 2021-01-04T21:59:24.225Z

couldnโ€™t you use that same reasoning to argue against having a default`:deps` key?

seancorfield 2021-01-04T21:59:34.225300Z

Although some folks think this is a bit much clj -M:repl:reflect:jedi-time:reveal:j14:classes:add-libs:dev+test ๐Ÿ™‚

seancorfield 2021-01-04T22:00:52.227Z

@peder.refsnes having a base set of dependencies that almost every use case builds on is very useful tho'... same with a base set of :paths...

2021-01-04T22:02:15.228500Z

I just have a :dev alias and have my editor always start a repl with that alias. It's pretty easy in emacs on both cider and inf-clojure. Do other editors offer something like this?

seancorfield 2021-01-04T22:03:51.230500Z

I always start my REPL separately (and leave it running for ages -- my current REPL was started on December 24th!) and then connect one or more editors or other tools to it.

hanDerPeder 2021-01-04T22:05:33.231600Z

@seancorfield of course, just being pedantic ๐Ÿ™‚

2021-01-04T22:07:59.232500Z

That's impressive! I can't seem to go a day without some catastrophic crash that I brought on myself

vlaaad 2021-01-04T22:11:28.233200Z

how do you ensure your code is live when e.g. switching between branches?

seancorfield 2021-01-04T22:26:22.234200Z

@vlaaad We rarely have long-lived branches and for the most part the code changes across multiple branches are accretive, rather than contradictory. I almost never need to require ... :reload-all (but I do have it bound to a hot key in VS Code). I occasionally need to remove a namespace (and then load it back in), if I'm changing aliases around (and, again, I have remove-ns bound to a hot key as well).

seancorfield 2021-01-04T22:28:48.234400Z

(and I tend to develop against multiple server processes all running from inside the REPL -- we have an "everything" subproject in our monorepo that has :local/root dependencies on all the other subprojects so we can start a REPL there and have all source/test code and all dependencies available in a single REPL)