Fork me on GitHub
#leiningen
<
2018-06-12
>
gfredericks16:06:10

I have an exciting thing happening with a plugin I've wittled it down to a pretty basic setup where there's a plugin ns with a hooks function that adds an empty-function-hook to an empty task in another ns i.e., there's no functionality here, other than adding an empty hook to an empty task that never gets run the symptom is that lein check works fine but lein with-profiles -dev check throws an NPE note there is no dev profile, so it should be a NOOP; adding an empty dev profile doesn't change anything also lein with-profiles -somethingelse check also fails

gfredericks16:06:23

seems like the hooks metadata got removed from some var (presumably the task being hooked, which never gets called?); very strange

mikerod17:06:18

@gfredericks I don’t have any great insight there. The only thought that sprung to mind was that lein check does a clojure.core/load on namespaces given for the “classpath” in question. That is a forceful reload of namespaces that could perhaps wipe out something like var metadata. However, I don’t see any reason that’d cause the problem you see (I don’t get how the metadata would be removed from the relevant vars in this situation). One way to troubleshot it may be to run it against your own modified leiningen or robert.hooke, where you add a print for the var that is being deref’ed for metadata prior to the NPE. May help.

gfredericks18:06:20

👍 I'll poke around

gfredericks19:06:42

the NPE is happening in a finally, so I guess it could be masking a real exception

gfredericks19:06:44

what's the easiest way to experiment with the installed leiningen? e.g., how could I get a user.clj onto lein's classpath so I could do some monkeypatching?

mikerod20:06:35

@gfredericks I’d typically just checkout the leiningen from github, use the tag for whatever release version you are interested in (if it matters).

mikerod20:06:47

so

git clone <leiningen-path>
cd leiningen
lein repl ;; or whatever you like to do for a repl, cider-jack-in etc