cursive

emccue 2025-02-25T04:21:08.429509Z

This isn't so much a cursive question as an IntelliJ plugin question, but this is the best place I can think of to ask: How hard would it be / what apis should I be looking at to read dependencies from a run configuration. As in, if I had a file like

--class-path ... --module-path ...
under dependencySets/example , make what is on those paths available to the editor. Talking about "regular" java since thats the world that lacks a deps.edn equivalent

cfleming 2025-02-25T14:50:58.274269Z

It depends on what you mean by "make those paths available". Do you mean something like the deps project sync?

emccue 2025-02-25T14:51:17.054619Z

I mean something like the deps project sync

emccue 2025-02-25T14:53:25.981979Z

I made a cli tool that turns a file like this

[project]
defaultUsage="--class-path"

[[project.dependencies]]
coordinate="pkg:maven/com.fasterxml.jackson.core/jackson-databind@2.18.2"

[[project.dependencies]]
coordinate="pkg:maven/org.junit.jupiter/junit-jupiter-api@5.11.4"
dependencySets=["test"]

[[project.dependencies]]
coordinate="build/javac"
dependencySets=["junit"]

[[project.dependencies]]
coordinate="pkg:maven/org.junit.platform/junit-platform-console@1.10.2"
dependencySets=["junit"]

[[project.dependencies]]
coordinate="pkg:maven/org.junit.jupiter/junit-jupiter-engine@5.10.2"
dependencySets=["junit"]

[[project.dependencies]]
coordinate="pkg:maven/dev.mccue/tools-jdk@2025.01.31"
dependencySets=["build"]

[[project.dependencies]]
coordinate="pkg:maven/dev.mccue/tools-junit@2025.01.31"
dependencySets=["build"]

[[project.dependencies]]
coordinate="pkg:maven/info.picocli/picocli@4.7.6"
dependencySets=["build"]

[project.dependencySets.test]
extends="default"

[project.dependencySets.junit]
extends="test"
into a folder like
dependencySets/
  build
  default
  junit
  test
Where each of these files looks like
--class-path
/Users/emccue/.jresolve/....
--module-path
...
And thats enough to be a "partial basis". java @dependencySets/default src/Main.java gets you your deps

emccue 2025-02-25T14:54:04.275249Z

but no editor will see/understand that.

cfleming 2025-02-25T14:57:53.820149Z

So, that is surprisingly complicated. In general, build tools are the bane of my life, and by far the most complicated ongoing part of Cursive. I would recommend either trying to generate files for an existing, supported build system (e.g. Maven, or perhaps deps? I use it to manage several non-Clojure projects), or perhaps looking into https://build-server-protocol.github.io.

cfleming 2025-02-25T14:58:20.004889Z

Stepping back a bit, why do you want to do this?

emccue 2025-02-25T15:02:37.770389Z

because I want to supplant maven/gradle for early learning usage

cfleming 2025-02-25T15:04:15.604179Z

What do you mean by "early learning usage"? Just trying to understand the use case a bit better.

emccue 2025-02-25T15:04:16.836229Z

i.e. instead of a build tool I want them to use a tool that just gets them dependencies, then they learn how those wire up into the different CLI tools

emccue 2025-02-25T15:05:04.317319Z

like instead of the hop being between java src/Main.java --- directly to ---> mvn clean compile package + googling and finding the shade plugin

emccue 2025-02-25T15:05:09.167689Z

I want the path to be

emccue 2025-02-25T15:06:17.973389Z

java src/Main.java -> java --class-path some.jar src/Main.java -> java @dependencySets/default src/Main.java -> javac @dependencySets/default -d classes --module-source-path ... and so on

emccue 2025-02-25T15:06:53.111489Z

basically detaching the "getting dependencies" from "building code" tasks

emccue 2025-02-25T15:07:52.488049Z

i've already gone down this path far enough to have written my own clone of tools.deps and a java partial equivalent to tools.build (that directly executes the cli tools)

emccue 2025-02-25T15:08:08.000079Z

i got it working if you dump dependencies in a folder

emccue 2025-02-25T15:08:42.204439Z

but if I want to explain the --module-path vs the --class-path that makes it a smidge hard

cfleming 2025-02-25T15:08:52.666349Z

I see. That is unfortunately very complicated in IntelliJ. You could do something like dump the deps in a folder, right, and I believe there's a library type which is "use everything in the folder"

emccue 2025-02-25T15:08:56.539519Z

doubly so for --processor-module-path, etc.

cfleming 2025-02-25T15:09:14.488419Z

Right, but you don't need to sync the module path to IntelliJ, right? Just the deps?

emccue 2025-02-25T15:09:16.819319Z

yeah and I can already do that with jresolve --output-directory libs pkg:maven/...

emccue 2025-02-25T15:10:39.897009Z

> Right, but you don't need to sync the module path to IntelliJ, right? Just the deps? eh? Like if we consider the one dep i keep seeing that needs to go on the module path; thats javafx

emccue 2025-02-25T15:11:07.521789Z

so Ideally the intellij run button would know to put that one path on the module path and the rest on the class path

cfleming 2025-02-25T15:11:22.378829Z

I think that would be the easiest way do what you want. Next easiest would be to generate the build file for something that already exists.

cfleming 2025-02-25T15:11:29.061839Z

Oh, right, you want run configs too.

emccue 2025-02-25T15:12:09.203609Z

yeah my general vibe check is that the approach makes sense but everythings been kinda "but why not maven?"-ed at their core

cfleming 2025-02-25T15:13:42.388319Z

I think there's scope for a tool like this, but it's a decent chunk of work to integrate into IntelliJ. I only found BSP the other day, it would make sense for your use case but is still fairly experimental.

emccue 2025-02-25T16:28:48.692359Z

yeah... I've told other people this in other ways, but I think reforming Java is pure positive for the Clojure world too. People more educated and more comfortable touching the underlying physics are more likely to consider Clojure

emccue 2025-02-25T16:29:11.005159Z

rising tides, all ships, etc. - hence why i'm not going "please don't hate me, but im doing java"