Fork me on GitHub
#tools-deps
<
2018-06-30
>
dorab03:06:58

If I try lein ancient after incorporating lein-tools-deps in my project.clj it always tells me that the artifacts are up-to-date. What do I need to do to get lein ancient work with lein-tools-deps? Thanks.

hagmonk05:06:32

@dorab because with lein-tools-deps you're storing your deps in deps.edn, I'd recommend you use a tool that targets deps.edn directly. So far I only know of https://github.com/Olical/depot, but it works great

dorab15:06:12

Did exactly what I wanted.

stathissideris18:06:41

how alpha is add-lib? It fails for me like:

eggshell.controller> (deps/add-lib 'spec-provider {:mvn/version "0.4.14"})
true
eggshell.controller> (require 'spec-provider.provider)
FileNotFoundException Could not locate spec_provider/provider__init.class or spec_provider/provider.clj on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.  clojure.lang.RT.load (RT.java:463)

stathissideris18:06:40

If I try to add-lib again, it returns false

stathissideris18:06:53

which means that it didn’t have to add it again

dominicm18:06:26

@stathissideris don't know why that's happening, buut, you need to be under a DynamicClassLoader for it to work.

stathissideris18:06:59

I’m not even sure what that means 🙂

stathissideris18:06:04

I’m in a REPL, is that ok?

hiredman18:06:59

add-lib is very alpha

stathissideris18:06:44

@hiredman sounds like I have to wait for a bit longer before I integrate it into my app

dominicm20:06:39

@stathissideris it is possible to change the class loader of a repl, I believe it's in the recent history.

Alex Miller (Clojure team)20:06:34

add-lib works by finding the highest dynamic class loader in the current classloader chain and altering its loader sources

Alex Miller (Clojure team)20:06:06

Some repl contexts do not have a shared dcl above all repl invocations

Alex Miller (Clojure team)20:06:53

So changing it would not necessarily have any effect, I think nrepl creates a new context on every evaluation

Alex Miller (Clojure team)20:06:50

Using clj repl works for me but nrepl things I’ve tried do not

dominicm20:06:50

we've been talking about how to fix this in nrepl.

Alex Miller (Clojure team)20:06:15

Just need a dcl shared by all evals

stathissideris20:06:07

@alexmiller I’m trying to integrate add-lib to my Swing app (and yes, I do realize it’s 2018 😄 ), the REPL entered the discussion because I naively thought that calling add-lib from the app would also make it available to the REPL I’m developing with

stathissideris20:06:28

but having the new libs available in the repl is not essential to me

stathissideris21:06:20

I may need to read up on classloaders, I call add-lib from within a future, would that make a difference?

stathissideris21:06:03

@alexmiller this is the classloader chain within the future:

(#object[sun.misc.Launcher$AppClassLoader 0x42a57993 "sun.misc.Launcher$AppClassLoader@42a57993"] 
#object[sun.misc.Launcher$ExtClassLoader 0x4306c985 "sun.misc.Launcher$ExtClassLoader@4306c985"])
Starting with (.getContextClassLoader (Thread/currentThread)). So no DCL there, I guess that explains it

stathissideris21:06:59

oh, setContextClassLoader!

stathissideris21:06:19

@mfikes thanks, that looks like it may work 🙂

stathissideris21:06:54

@mfikes @dominicm some progress! it seems that setting the classloader as @mfikes demonstrated allows add-lib to work, but the added lib is still not available to the part of the app that needs to use it, presumably because it doesn’t share the same DCL… but now at least I understand how it works and I may be able to fix it somehow

stathissideris21:06:18

many thanks to all

mfikes21:06:17

@stathissideris Cool. IIRC, in the change linked above, I shoved that DCL in at the earliest possible moment.

mfikes21:06:16

(It is the very first bit of code executed in main, and my hope was that any threads spawned afterward would inherit it.)

Alex Miller (Clojure team)21:06:58

that should be the case

cfleming23:06:15

Just to check my understanding of this - is it the case that alembic no longer works under nREPL, because of the dynapath change for Java 9? Sounds like nREPL used to actually modify the URLClassLoader but can no longer do so?

cfleming05:07:47

Actually, I’ll ask this over in #nrepl