leiningen

N.B. The maintainers are on #leiningen on Libera chat IRC. Go there for direct support/bug reports.
reefersleep 2020-03-23T08:10:56.046600Z

I have a test-specific dependency that I would like not to burden the main project with. It’s in the :test profile’s dependency vector. Great. But when I start my repl, I get errors that the test ns that uses the dependency is missing it. How can I start my repl and exclude my test nses?

reefersleep 2020-03-24T08:34:53.049100Z

That’s what I was doing, @noisesmith, but I wanted to avoid forcing every other developer on this project to do the same

reefersleep 2020-03-24T08:55:11.049300Z

I ended up putting my dependency into the :dev profile vector like @jumar suggested, that solves my problem. I’m still wondering why test ns’es are loaded when I start my repl, but that’s a different issue.

2020-03-24T16:09:51.049500Z

loading all test namespaces is one of the behaviors of the test profile isn't it?

reefersleep 2020-03-25T09:02:54.000100Z

I don’t know. But I wasn’t explicitly running the test profile.

jumar 2020-03-23T08:17:56.046700Z

Why not adding them to the :dev profile? I mean, I'd definitely want my tests to be available in the REPL.

jumar 2020-03-23T08:18:22.046900Z

https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md#default-profiles > The `:dev` profile is used to specify project specific development tooling. Put things here if they are required for builds or tests, rather than just convenience tooling.

reefersleep 2020-03-23T08:47:31.047200Z

Good point. I’ll see if that makes sense in this project 🙂 Thanks!

reefersleep 2020-03-23T08:47:39.047400Z

Do you know if there’s a way to exclude stuff, though?

jumar 2020-03-23T08:48:56.047600Z

Sure, the :exclusions keyword: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L55

reefersleep 2020-03-23T08:53:22.047900Z

yeah, but I mean ns’es in the project

reefersleep 2020-03-23T11:10:41.048100Z

I don’t know if other people have had uses cases for it. Perhaps one would also like some scratch ns where crazy things could be coded, but which wouldn’t affect production, and perhaps not (automatically) other developers at dev time. You could then pull it into the repl at a later point if you wanted.

jumar 2020-03-23T11:22:54.048300Z

Namespaces are usually not loaded unless they are required. So if you don't require a particular file you can keep it there and it shouldn't break anybody's environment. That's said, things like lein check may go through every file...

reefersleep 2020-03-23T12:03:24.048500Z

Hm. That’s what I tought, too. Perhaps there’s something requiring our test ns’es dynamically.

reefersleep 2020-03-23T12:03:42.048700Z

(I get the dependency error at repl startup time)

2020-03-23T17:07:51.048900Z

I usually use lein with-profile +test repl myself, but putting them under dev is definitely more elegant...