Fork me on GitHub
#leiningen
<
2020-02-03
>
FiVo13:02:04

Hey, running into some issues when testing something with clojure 1.8. I get

Exception in thread "main" java.lang.RuntimeException: Unable to resolve var: *print-namespace-maps* in this context, compiling:(leiningen/core/main.clj:342:5)
using lein 2.9.1 the variable was introduced in clojure 1.9 is this expected behavior? https://github.com/technomancy/leiningen/blob/master/leiningen-core/src/leiningen/core/main.clj#L342

mikerod17:02:51

@finn.volkel I don’t think I understand enough context. It’d be easier if you could show a project.clj setup like you are describing with your error.

noisesmith17:02:56

what's the motivation for using clojure 1.8 instead of a newer one? afaik your options are downgrading lein ot an older version, or upgrading clojure

mikerod17:02:22

@finn.volkel I’m still confused. Why are you showing me the cider-nrepl project ?

mikerod17:02:30

or perhaps this is what you want to test - in that case though, the issue sounds like it just is that cider-nrepl no longer is 1.8 compatible - since it uses something new from 1.9 perhaps - I’m not sure if these profiles are all regularly tested for that project

mikerod17:02:41

leiningen’s clojure version is independent of your project’s version

mikerod17:02:44

that goes for all dependencies - unless you are writing a plugin - then you are on leiningen’s own classpath

mikerod17:02:46

(this is one major reason why leiningen defaults to launching 2 jvm’s - 1 for it’s own setup and libs, and one for your independent project runtime)

noisesmith17:02:21

there's a gotcha for trampoline though right?

mikerod17:02:26

which actually comes down to the eval-in-project and friends fns in leiningen.core.eval

mikerod17:02:38

I don’t know of a caveat w/trampoline

mikerod17:02:55

lein launches it’s own jvm first - emits some info for the next process to run w/ so it can shutdown

mikerod17:02:11

and later launches, I think it tries to avoid relaunching it’s first jvm if “nothing has changed with project setup”

noisesmith17:02:16

oh, I thought fast-trampoline would reuse the vm

mikerod17:02:32

you may referring to specific usages - that’s possible

mikerod17:02:43

I believe https://github.com/technomancy/leiningen/wiki/Faster goes through some of this - I’d have to re-read

noisesmith17:02:16

yeah, following that guide and using fast trampoline is the only time I've used trampoline, so I kind of conflated the two

mikerod17:02:52

Yeah, I think its doing more with it - for raw speed

noisesmith17:02:03

and that doesn't have the mentioned issue since it caches the state the lein jvm creates, it doesn't try to share a vm

mikerod17:02:06

not the only usage of it - at least how I see it

mikerod17:02:19

yeah, you should still get your own classpath for your project with the standard trampoline

mikerod17:02:30

meaning whatever clj version you support etc

FiVo17:02:38

I just got the error when running the tests. I guess it has to do with cider-nrepl containing some leiningen plugin.

mikerod17:02:28

on the surface (not looking at it), seems like it doesn’t correctly function with clj 1.8

mikerod17:02:31

and perhaps it’s just out of date

mikerod17:02:44

I’d recommend you do lein with-profile +1.8 test though

mikerod18:02:02

to avoid assuming which profiles you need - just take the defaults in addition to 1.8

mikerod18:02:19

but really, that comes down to how project is configured and things are expected to be ran

mikerod18:02:39

(assuming this is used - haven’t dug too much)

mikerod18:02:44

but it does do the +1.8 style

mikerod18:02:56

actually,

lein with-profile +$(CLOJURE_VERSION),+test,+plugin.mranderson/config

mikerod18:02:22

for the test task, the +test should be superfluous, but still probably just run it the same as the scripts

mikerod18:02:45

or you can acutlaly use this Makefile if you want to go about testing that way

mikerod18:02:03

Of course at this point, looks like a #cider question

FiVo18:02:35

yes already asked there as well, was just wondering if is more some wrong assumptions about leiningen