Fork me on GitHub
#tools-deps
<
2018-09-13
>
abp16:09:37

When automating tests and builds with clojure we need to download maven dependencies to the project folder ideally, so we can use gitlab CI caching on the maven dependencies in the project folder. Is there any way to do this with the clojure shellscript and tools.deps? With leiningen we used local-repo https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L145

alexmiller16:09:06

Yep, use a root attribute in deps.edn of :mvn/local-repo

abp16:09:52

We just found it too, but thanks anyway 🙂

richiardiandrea18:09:47

Hello folks! I am a bit confused by this: clj -C:gen:new:tmpl -Stree <- no deps is shown clj -R:gen:new:tmpl -Stree <- deps are shown but the doc says that -C is for building the classpath...

richiardiandrea18:09:47

if I am building the classpath, why is -C not showing my deps in -Stree?

richiardiandrea18:09:03

(and of course I don't have them in the classpath as well)

hiredman18:09:39

is there a reason you aren't using -A

hiredman18:09:35

my admittedly not very deep understanding is, -A does a lot of stuff, an the other flags like -C and -R do subparts of what -A, I suspect -C only merges the paths entries not the dependency entries. using -A seems to provide most of the kind of default what you would expect from "merging"

hiredman18:09:43

there used to be a comment (maybe there still is) the default deps.edn file that said '''

hiredman18:09:48

;;   make-classpath aliases (-C) affect the classpath generation, options:
 ;;     :extra-paths - vector of additional paths to add to the classpath
 ;;     :classpath-overrides - map of lib to path that overrides the result of resolving deps

richiardiandrea18:09:28

@hiredman my alias contains :main-opts and I do not want to use it for new and gen for now

richiardiandrea18:09:43

I am launching a REPL against them

seancorfield18:09:07

Beat me to it... Yeah, @richiardiandrea -C only pulls in paths and the library overrides. -R is for dependencies (`:deps`, :extra-deps, and :override-deps I think).

richiardiandrea18:09:40

ok I think I missed that part of the doc, thanks a lot, I thought classpath meant both path and deps

richiardiandrea18:09:51

as customary in all the previous tools 😉

seancorfield18:09:24

You mostly want -R or -M but if you are bringing in test code you probably want -C for that 🙂

seancorfield18:09:59

What I recommend is not having :main-opts in the same alias as anything else -- use a separate alias that is just for running that main.

seancorfield18:09:30

For example, in several projects I have :test to set everything up for testing and :runner to actually run the tests.

richiardiandrea18:09:10

so I am using new and telling my team to just do clj -A:new:tmpl cljs-template org-scope/my-project

seancorfield18:09:14

I tend to keep all my aliases small and orthogonal -- so they can be composed 🙂

richiardiandrea18:09:31

but now I am just in need of a REPL with the deps

richiardiandrea18:09:40

so I do not want -M I guess 😉

seancorfield18:09:56

Which is exactly why you want the main opts separate from the deps 🙂

richiardiandrea18:09:01

Anyways, this works clojure -R:gen:new:tmpl -A:nrepl