Is there any way I can use deps to just execute a main() function from a Java class, without loading Clojure first? I need to control the classloader, so I’d like to build the classpath using deps but then execute a class which will later bootstrap Clojure.
There is an option to have deps print out the class path if I recall
Yes, -Spath, but that means I need a script of some kind, which I was hoping to avoid.
I can’t see any option for this though.
I don't understand why deps is relevant here?
the Clojure CLI is a Clojure program runner - it always ultimately uses clojure.main right now as the main class
but if you have a classpath and a main, why is either deps or the CLI even relevant
just call java
Because I’d like to use deps to create the classpath. I can do it with a script as hiredman suggests, but then it’s more difficult to debug the resulting process as opposed to running it directly via Cursive.
And I lose all sorts of affordances that IntelliJ provides for JVM processes.
you can use tools.deps as a library to create the classpath (it's in the basis)
when you say "deps" I am unclear what that means, and I think more precision would be useful. do you mean tools.deps the library? the Clojure CLI?
I’d like to use Cursive’s existing machinery, which runs via deps.clj (equivalent of the CLI). But it seems like I can’t do that without some kind of second hop (either a script or a Java process which creates the classpath) before invoking the actual app.
I’m trying to do this because I’m running the tests for Cursive, and I’m getting issues because of how Clojure initialises the classloader. I’d like to run some Java code before loading Clojure so I can control that. This is all because the latest version of lein has upgraded the maven resolver it uses, and my tests now fail because the classes now conflict with ones which the IntelliJ platform provides. I thought it would be easy, but it’s not turning out that way unfortunately.
Anyway, I can keep looking for a solution, I just wanted to double check that the CLI didn’t provide what I was hoping for.