Fork me on GitHub
#tools-deps
<
2022-05-04
>
simongray09:05:55

There is a Leningen example but it says [io.github.mightguy/symspell "6.6.154" :extension "pom"] and I have no idea what to do about the :extension "pom" part. Converting it to io.github.mightguy/symspell {:mvn/version "6.6.154"} doesn’t seem to work.

simongray12:05:49

Aha, it would seem so!

Alex Miller (Clojure team)13:05:59

Yes, it is. I've done some of the internal work for this but still more to do

πŸ‘ 1
simongray09:05:42

(I wrote io.github.mightguy/symspell-lib {:mvn/version "6.6.154"} as that was referenced elsewhere and this seemed to work)

Olical10:05:11

Hey everyone! Has anyone noticed with Clojure 1.11+ that their deps aren't fetching when they try and run things from the Clojure CLI now? I have to run the exact command with -P then run it again without which is proving REALLY awkward with wrapped tools like Kaocha. This is happening across all projects of mine, so it's in the Clojure CLI install rather than the projects themselves. The only thing that changed (I think) was the Clojure CLI version updating from 1.10 to 1.11+. Has something changed in the CLI contract and now we need to remember to fetch these deps? Is this a bug? Misconfiguration on my part somehow?

Alex Miller (Clojure team)13:05:37

No intentional change that I can think of

Alex Miller (Clojure team)13:05:10

If you have something reproducible, happy to look at it

Alex Miller (Clojure team)13:05:14

What do you actually see when you run?

Olical13:05:38

Hmm, well it seemed like if I ran clj or used a jack-in it would try to start my Clojure projects without fetching the dependencies they required (when it definitely used to!). I did delete my .m2 recently, so maybe the .cpcache also needs clearing per dir? :thinking_face: I just tried it in a blank directory and it fetched the dependency! So I'd put it down to .m2/.cpcache interplay (if that's possible?) or the arguments we pass to clj now have it skip fetching deps since we have some combination of -A -M...

Olical13:05:57

I'll see if I can reproduce it and check if clearing .cpcache etc helps.

Alex Miller (Clojure team)13:05:08

If you have a cpcache, and you have the same command, it won't fetch anything

Alex Miller (Clojure team)13:05:56

If you alter the m2, you'll need to either erase the cpcache or use -Sforce to force a redownload of the deps

Olical13:05:05

Got it! I feel like I haven't noticed this before and it used to still fetch everything even if I wiped my .m2, but maybe I just got lucky or accidentally fixed it. Thanks for the insight / prompting me to think about it more!

Olical13:05:10

Makes sense though.

Alex Miller (Clojure team)13:05:42

It has always worked like this

Olical13:05:51

Then somehow I accidentally avoided it for years and I have no idea how πŸ˜…

Alex Miller (Clojure team)14:05:10

by not deleting your m2?

Olical14:05:55

Oh no, I've cleared that many many times, mostly around where I mounted it into docker containers which ends up creating the files under root which complicates other things. (I should work around that by keeping a separate root .m2 from my user really) I guess I remembered to remove my .cpcache in the past and it slipped from my memory.

brendnz07:05:57

Is it good practice to periodically delete our m2?

Olical09:05:31

I don't think so if you don't need to. As I mentioned higher up in the thread, I did it because I'd been mounting my .m2 into docker containers which poisons it with root owned files. I could chown them too, but I'm being lazy and silly. The only reason I'd recommend it is if you were REALLY tight on disk space, your .m2 was huge and you know you're only working with a few JVM deps now so you won't need to redownload them all.

❀️ 1
Olical09:05:31

That way you clear out old versions of deps you no longer use and redownload the ones you need. But as I've found, you must delete your .cpcache directories in your projects to ensure it'll re-fetch dependencies.

❀️ 1
Alex Miller (Clojure team)13:05:45

You can also use -Sforce to force recompute of the classpath (and download if needed)

practicalli-johnny11:05:03

Are there command line tools (or REPL based tools) to help find the full name of a library to add as a dependency? I can find versions of libraries using the built-in clojure -X:deps find-versions :lib fully-qualified/library-name , which works very nicely assuming I know the correct library name, but that is the bit I'd like a tool for. I have been using https://github.com/hagmonk/find-deps although that seemed to stop working. I forked it and got it working and fixed some of the deprecation warnings (which I'll send a PR for, although I think some of the dependency versions in that project also need updating, so may need to hack a bit more) Any alternative CLI tool suggestions are welcome (otherwise I'll try find some time to improve find-deps).

practicalli-johnny11:05:31

Running find-deps I was getting a very strange warning

Error building classpath. Manifest type not detected when finding deps for swisseph/swisseph in coordinate #:loca
01/swisseph-2.01.00-01.jar"}
Changing to a different directory fixed the issue, so I assume it was some kind of cache issue. I couldnt find that library in the dependency tree for find-deps or online. Very strange.

Alex Miller (Clojure team)13:05:14

There's some speculative work on dep searching in the add-libs3 branch of tools.deps, but it's pretty fiddly, not sure it will ever be integrated

πŸ‘ 1
seancorfield17:05:53

Given that the Maven coordinates can be arbitrarily different to the namespaces within a library, I don't see how that could work, short of indexing the whole of Clojars (and a lot of Maven Central)?

seancorfield17:05:43

OK, and they're essentially brute force searches? (I know "go read the code" πŸ™‚ )

ag19:05:04

I need something akin to :prep-tasks for lein's uberjar. Basically, some scripts (esp. front-end related - shadow-cljs, etc.) generate a bunch of throwaway files and I need to clean them up before packaging. What's the recommended way of dealing with that? A custom alias that calls a function to clean them up? I'm using {uberdeps/uberdeps {:mvn/version "1.1.4"}} for packaging; I don't know if that's relevant

seancorfield19:05:24

@ag Do you have a build.clj file?

seancorfield19:05:08

I do pretty much all my testing/packaging via tools.build these days and then tasks are "just code" so they can do whatever you need.

ag19:05:45

Oh, that's interesting. I did not know about this. Still new to deps.edn stuff, been stuck with Leiningen until very recently. I'll try to learn about this. Thank you!

ghadi20:05:11

@ag https://clojure.org/guides/tools_build the guide shows some examples of builds as ordinary programs

πŸ‘ 1
ag20:05:45

it's not possible to re-use keys from one alias in another, right? e.g, I have alias :dev that adds extra-paths and deps, if I want to use the same stuff in other alias, e.g. :test, I'd have to repeatedly declare those, correct?

seancorfield20:05:27

clojure -A:dev:test ?

seancorfield20:05:47

Or if it's a subset of :dev that you need for :test, split :dev in two.

seancorfield20:05:37

@ag This is typically how I start my main dev REPL for work: SOCKET_REPL_PORT=5000 clojure -J-Dlog4j2.configurationFile=log4j2-sean.properties -M:rebel:portal:everything:dev:test:runner:build:dev/repl but sometimes I add even more aliases (such as :reflect:jedi-time:add-libs πŸ™‚ )

ag20:05:46

Yes, I know I can chain aliases, but that means some of them won't work without others. If that's accepted, I'm okay with that, I guess.

dergutemoritz20:05:03

And https://ask.clojure.org/index.php/10564/specify-an-alias-that-is-a-set-of-other-aliases (linked from the second jira issue) if you'd like to leave an upvote πŸ™‚

Cora (she/her)21:05:02

hmm aliases that depend on aliases might be neat

Alex Miller (Clojure team)22:05:53

well don't get too attached to this particular solution, the problem is about composition and interacts with other problems

πŸ‘ 1