depstar

Discussion around https://github.com/seancorfield/depstar
katox 2021-01-08T11:07:51.347900Z

Hi, I'm trying to do a dry-run that would pre-download all deps needed for uberjar build with depstar 2.0. I tried something like this clojure -Sdeps '{:mvn/local-repo "./.m2/repository"}' -Xdepstar but depstar still downloads to $HOME/.m2 . Moving :mvn/local-repo into the depstar alias did not help. Any ideas?

katox 2021-01-08T13:54:21.348900Z

by further experimenting I found out that only -Sdeps deps config is ignored. If I put it into one of other possible locations it works.

seancorfield 2021-01-08T18:20:12.350100Z

@katox depstar computes the project basis from the deps.edn files only. -Sdeps affects the classpath used to run depstar. It does not affect the classpath depstar uses to find things to put into the JAR.

seancorfield 2021-01-08T18:21:03.351Z

What you could do is tell depstar to use the classpath that clojure -Sdeps ... computes: clojure -X:depstar :classpath $(clojure -Spath -Sdeps ...)

katox 2021-01-08T20:43:26.357100Z

@seancorfield thank you it makes sense. However this is not about classpath this is about where depstar itself tries to find .jar files in while resolving versions. -Sdeps is used to specify the merged config (ephemeral deps.edn) not dependencies (the :deps key itself). So in the end the solution was to put {:mvn/local-repo "./.m2/repository"} into ~/.clojure/deps.edn for CI to pick up (while preserving the default for developers). It works as expected it's just very confusing that it doesn't work when specified as config data on the command line (the reference docs mention the merge as root/user/project/config). The other thing is that mvn/local-repo is undocumented I found it while searching forums.

seancorfield 2021-01-08T21:07:32.360500Z

Ah, yeah, just the classpath setting alone isn't going to help. depstar used to use the runtime basis for the JAR file but multiple people from Cognitect said it was a bad idea (including the original author) so when I produced the 2.0 version, I switched it to use the project basis per their recommendation -- and it is how a lot of other tools work, using just the EDN files. I think this separation of the runtime basis (used to run the tool) and the project basis (used by the tool to do whatever its job is) is something folks are going to have to get used to: -Sdeps doesn't affect any of those tools that compute the project basis from the EDN files.

seancorfield 2021-01-08T21:08:17.361200Z

By the time depstar runs, -Sdeps has "gone away". It's an option for the Clojure CLI script itself, not the tool that is being run.

seancorfield 2021-01-08T21:08:55.361900Z

I'll add a note to the README to make that clearer...

👍 1