Fork me on GitHub
#boot
<
2015-08-02
>
aengelberg01:08:49

What's the recommended way to start up a pod that uses a different version of Clojure than the parent environment?

micha01:08:05

@aengelberg: you can set a dependency on org.clojure/clojure in the pod's env :dependencies

micha01:08:24

it will load whichever version you specify there

aengelberg01:08:52

What if there is already a version of clojure in the parent environment? If I conj a new one onto the end, does that overwrite it?

micha01:08:31

how do you mean?

micha01:08:06

you mean if you conj [org.clojure/clojure "1.6.0"] onto [[org.clojure/clojure "1.7.0"]] for example?

micha01:08:21

in that case there will be two clojure deps

aengelberg01:08:04

Yeah. In that case, will weird stuff happen from two different dependencies?

micha01:08:41

it really shouldn't but you'll have some extra classes on the classpath

micha01:08:57

we ran into issues with that in the past

aengelberg01:08:21

So maybe I should do a filter to remove the already existing dep?

micha01:08:27

like libraries detecting clojure version by looking for certain inner classes on the class path

micha01:08:46

yeah that would be the safest thing to do, i think

micha01:08:01

actually i think maven will only fetch one

micha01:08:25

haha, oh right, i remember now simple_smile

micha01:08:41

but i think in this case maven will fetch the first one in the dependency vector

aengelberg02:08:00

Slightly related question, what if project A has dep vector [[project-B "1.0"] [org.clojure/clojure "1.7.0"]] and project B has dep vector [[org.clojure/clojure "1.6.0"]]? Which clojure jars will be fetched?

aengelberg02:08:33

I believe that leiningen lets project A override the clojure dependency in this case.

micha02:08:26

i think 1.7.0 in that case

micha02:08:46

maven will choose the "closest" dependency when there are conflicting transitive deps

aengelberg02:08:54

Is :provided generally used in the clojure dependency to avoid complexity here?

micha02:08:27

:provided will not affect the project itself

micha02:08:57

i mean when you have a dependency in your project that is of scope provided, when you start boot it will fetch that dependency

micha02:08:36

however it will not be fetched transitively when your project is included as a dependency in another project

micha02:08:25

i'm not sure if it makes much difference in practice really

micha02:08:05

i was thinking that maybe scopes could be used to reduce conflicts with framework deps

micha02:08:12

like clojure itself and clojurescript etc

micha02:08:38

but now i am starting to think that the problem can't be solved on the packaging end

micha02:08:01

we just have to add explicit dependencies to the consuming project

micha02:08:40

it makes tooling a little harder to use, though, so it's kind of a shame

aengelberg02:08:31

I think that makes sense. I'm writing a plugin that's like cljx, so it has a clojurescript dependency in only the test scope. Also, the consumers of this plugin are libraries aiming to be backwards compatible with earlier versions of Clojure. So it helps to understand the Clojure dependency magic so I know how to best structure this project.

micha02:08:04

the unfortunate thing is that there isn't a good way to handle :scope "provided" conflicts

micha02:08:14

i mean in the consuming project

micha02:08:29

at least if you declare the transitive dependency people can debug conflicts using the normal methods, like lein deps :tree or boot show -p

aengelberg02:08:41

What do you mean by :scope "provided" conflicts?

aengelberg03:08:24

Is there a boot equivalent of the :dev profile? Would like to add resource paths, source paths, etc. only when testing or REPLing.

martinklepsch10:08:58

basically use tasks that modify the env as you wish simple_smile

micha13:08:15

@aengelberg: with respect to the profiles, what tasks would you be running when you wouldn't want those resource paths, source paths etc on the classpath?

micha13:08:53

because that's a good use case for the :scope "test" dependency annotation