Fork me on GitHub
#leiningen
<
2018-03-15
>
Shantanu Kumar06:03:04

Is GnuWin32 still the recommended package to install on Windows prior to installing Leiningen?

mbjarland11:03:22

in a leiningen project, how would I go about printing the dependency tree that will be visible to the user of my lib once I deploy it to clojars? Doing lein with-profiles -dev deps :tree still seems to add things like clojure-complete and org.clojure/tools.nrepl etc...

mikerod16:03:34

@mbjarland I’m not sure if there is a way with deps :tree. I’d think it’d work, but haven’t looked into it

mikerod16:03:05

No, that doesn’t make sense, disregard. Deleted it. I’d think deps :tree would work if you get the correct active profiles

mbjarland16:03:12

@mikerod yes, that is part of my confusion, what are the active profiles I should enable to get the dependencies an user of the library would see once deployed

mikerod16:03:02

@mbjarland so you want the dependencies as if you were doing lein jar ?

mbjarland16:03:57

@mikerod I want whatever dependencies you would see if you added my lib to the project.clj of your project and ran lein deps :tree

mbjarland16:03:56

I would guess the deps for lein jar and what I’m asking for is the same thing, yes

mikerod16:03:53

yeah, lein deps should just be based on the aether resolution stuff (maven style deps and coords)

mikerod16:03:58

@mbjarland my guess is you have more profiles other than just :dev bringing in these things

mikerod16:03:22

It’d be better if you could explicitly only specify the profiles you wanted to keep (whitelist instead of blacklist)

mbjarland16:03:37

@mikerod that is my guess as well…as for what profiles are active and/or which profile I should enable to only get the dependencies packed into the jar pom.xml etc I’m at a loss for

mikerod17:03:48

@mbjarland it seems difficult to be able to easily get the same pom generation profile state as in lein pom

mikerod17:03:00

I don’t know of a clear way to mimic that

mbjarland17:03:15

which seems a little strange to me in a build tool

mikerod17:03:15

there is logic around keeping :sticky profiles and :provided profiles

mikerod17:03:31

but I don’t know how to enforce that on other tasks, like lein deps

mikerod17:03:41

then again, now you have me wondering what profiles lein deps makes active by default

mikerod17:03:54

I don’t know that it makes sense to me for it to have dev profiles active…

mbjarland17:03:56

dev for sure

mikerod17:03:23

I guess originally/historically lein deps was meant to download deps locally

mikerod17:03:33

I think it was a prerequisite step to other tasks or something like that

mikerod17:03:44

nowadays, that isn’t true it. I believe it is mentioned as that’s sort of a deprecated thing

mbjarland17:03:55

then again, you can see (at least in the :tree output) in the output that some dependencies are :scope "test" etc

mbjarland17:03:41

right, I saw that in the lein cli help deps Download all dependencies.

mikerod17:03:16

it just gets the :default profiles if you don’t specify (so what a lot of tasks do)

mbjarland17:03:20

anyway, I figured I was missing something obvious but sounds to me like this might actually be a bit more esoteric than I expected

mikerod17:03:40

I just think you have to carefully choose the profiles with-profile

mikerod17:03:48

maybe like

mbjarland17:03:03

how would I go about listing all the profiles or figuring out what profiles lein jar uses

mikerod17:03:05

lein with-profile :provided deps :tree hah

mikerod17:03:18

but you wouldn’t get your :leaky profiles that way (if you have any)

mbjarland17:03:26

profiles aside from the ones I have defined myself feel very opaque to me

mikerod17:03:05

Lein :default profiles are [:base :system :user :provided :dev]

mikerod17:03:26

so you could also jus tdo

mikerod17:03:48

lein with-profile -base,-system,-user,-dev deps :tree I guess

mikerod17:03:59

that’d let you get the rest of your profiles brought in naturally possibly

mbjarland17:03:34

naturally the pom.xml contained within the generated jar file lists the right deps

mikerod17:03:42

:provided would be included in your artifact as a dependency. If it follows Maven resolution rules, a “provided” scope dep wouldn’t bring any further transitive dependencies onto the classpath (it is meant to be provided by the consumer)

mikerod17:03:04

Yeah, I may go back to my earlier other idea that is less elegant and just use Maven dep tree on the generated pom

mikerod17:03:27

You’ll have to keep in mind the scopes, e.g. “test” scope wouldn’t be something a consuming app would get

mikerod17:03:10

Sounds like there should be a lein plugin (or built-in with deps etc) that can report on these sort of more tricky dependency lists

mbjarland17:03:40

yeah I come from a substantial number of years building applications in other languages for the JVM using gradle

mbjarland17:03:03

to me this should be the most obvious dependency list to ask for “when I publish my lib, what will the user see”

mikerod17:03:34

I’m not the definitive source of truth on lein though. Perhaps I’m missing something that could be done here.

mbjarland17:03:27

yeah and many thanks for all the help, I didn’t mean to be ungrateful, just a little befuddled by the seeming difficulty here

mikerod17:03:33

not the same question precisely though

mikerod17:03:35

sure. Yeah, I’ve struggled a few times with uberjar/jar/pom things related to active profiles and how to know them easier. So it relates to what I’ve encountered before

mikerod17:03:44

I often just end up reading the lein code when in a big jam

mikerod17:03:17

I’d say that at least the codebase is relatively easy to sift through 😛 not that makes it nice when wanting to do something like this

mbjarland17:03:27

while I’m here I might as well ask…is there some best practice for choosing the namespace of clojars deployments…i.e. just my-special-lib or mygroup/my-special-lib

mbjarland17:03:50

I see both and am wondering if one or the other is considered bad karma

mikerod18:03:32

@mbjarland I’m pretty sure the recommendation is to always use a group, not bare names

mikerod18:03:42

although it obviously hsn’t been followed all the time in the past

mikerod18:03:54

This has came up on some other channels recently too (can’t remember specifically)

mbjarland18:03:43

doh, shame I already published the jar to clojars…the way I understand it, once published, clojars is forever

mikerod18:03:53

yeah, maybe

mikerod18:03:05

I can’t actually enumerate the reasons to use groups beyond avoid collisions

mikerod18:03:19

I think it’s bitten written about though elsewhere. I guess you get that bare name forever now

mikerod18:03:52

I actually don’t know about clojars management and removal etc. So I’m no help to you there.

mbjarland18:03:00

hrm…ok not exactly happy about it, trying to be a good citizen and publish according to the mojo of the community

mbjarland18:03:50

I’ll look into it, but I remember reading that once published things stay (ala Rich Hickey’s presentation about dependencies and why mavencentral rocks)

mikerod18:03:10

Sure, the idea is to not take things away - breaks people

mikerod18:03:22

I think they handle the removals case-by-case in these cases (even maven)

mikerod18:03:01

https://github.com/clojars/clojars-web/wiki/Groups I don’t know that this really is very clera

mikerod18:03:18

It sounds like it encourages groups, but doesn’t like Maven using reverse-domain names

mikerod18:03:56

but if you push to a group like mbjarland/my-lib, you then own the mbjarland group

mikerod18:03:00

(if it didn’t exist)

mikerod18:03:41

I think if you don’t use a group, you may implicitly get a group of the same name as your lib my-lib/my-lib It just can be truncated to my-lib as a lein style dep

danielcompton21:03:04

@mikerod I've updated the docs for Groups, we don't discourage use of reverse DNS groups anymore

danielcompton21:03:25

Is that clearer, is there more we should add there?

mikerod21:03:26

It is clearer than before

mikerod21:03:46

the one thing I noticed in the sentence structure there is it wasn’t immediately clear that clojars actively encourages the use of a group though

mikerod21:03:39

However, what you changed is still clearer to me. Before the change it sounded like it may be recommending no group. It was just ambiguous language semantics before I think.