Fork me on GitHub
#tools-deps
<
2023-03-14
>
lvh15:03:30

Hey! I’m trying to set java.library.path via :jvm-opts, but it seems to have no effect. 🧵

lvh15:03:37

signcryption-demo on  main [!] via :coffee: v19.0.2 
❯ cat deps.edn
{:paths ["src" "resources"]
 :deps {org.clojure/clojure {:mvn/version "1.11.1"}
        caesium/caesium {:mvn/version "0.15.0"}
        nrepl/bencode {:mvn/version "1.1.0" :lvh/comment "netstring impl"}}

 :jvm-opts ["-Djava.library.path=/opt/homebrew/lib"]

 :aliases
 {:test
  {:extra-paths ["test"]
   :extra-deps {org.clojure/test.check {:mvn/version "1.1.1"}
                io.github.cognitect-labs/test-runner
                {:git/tag "v0.5.1" :git/sha "dfb30dd"}}}
  :build {:deps {io.github.clojure/tools.build
                 {:git/tag "v0.9.2" :git/sha "fe6b140"}
                 slipset/deps-deploy {:mvn/version "0.2.0"}}
          :ns-default build}}}

signcryption-demo on  main [!] via :coffee: v19.0.2
❯ clj
Clojure 1.11.1
user=> (System/getProperty "java.library.path")
"/Users/lvh/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:."
user=>

lvh15:03:33

the same string works via JAVA_OPTS

borkdude15:03:57

:jvm-opts needs to go in an alias

dvingo10:03:52

Can this be marked as a bug/feature request in tools.deps ? Is there a reason it's not allowed? Pretty terrible user experience, especially since it's a silent failure.

borkdude10:03:47

I think it was intentionally not supported and I'll add a check to clj-kondo for the next release, but always good to double-check with @U064X3EF3

dvingo10:03:56

Would love to hear the why - this pretty clearly breaks the principle of least astonishment

borkdude11:03:13

My guess would be that it's similar to why :main-opts belong to an alias: you don't always want the same set of main-opts for every invocation.

borkdude11:03:54

but I can easily see why global jvm opts are desirable

dvingo11:03:59

Whether or not it should be allowed at the top level, I suggest some error be thrown by tools.deps. This is one of those things that's small effort for the tool but provides lots of benefits for users. Especially for new users, the fact that there's not even a warning is really frustrating. Compared to user-facing tools in other programming languages it's pretty embarrassing.

borkdude11:03:26

well, there's also the docs ;)

dvingo11:03:41

If I'm not being clear, this about user experience. I think adding a sanity check to deps.edn performed by the tool itself would be a great way to improve the experience of using clojure. The way that a tool interacts with its users says something about tool itself. If it's not clear I'm saying that the behavior of tools.deps makes me think the tool is hostile to users, not welcoming or friendly. I don't think this is intended by the creators of the tool. As someone who has experienced non-clojure developers attempt to use clojure and fail, this stuff matters in changing how clojure is perceived to people who are not steeped in it.

borkdude11:03:39

top level jvm-opts has come up before and there's a clj-kondo issue for this reason too, so you're not wrong

dvingo11:03:08

This is low-hanging fruit, there is a great library waiting to be used just for this purpose https://github.com/bhauman/spell-spec

Alex Miller (Clojure team)12:03:23

There is a ticket for this, but the reason we don’t have global jvm-opts is because you use the CLI to launch all kinds of tools as well as your application, and it seems hard for me to come up with a jvm opt that you would want applied in all those situations

👍 2
Alex Miller (Clojure team)12:03:41

What I have been considering is whether there should be a well known alias that applies for the “project classpath” context, or whether there is something even more generally useful that could serve this purpose (and others)

borkdude12:03:47

isn't that already what the top level is for?

borkdude12:03:12

maybe :replace-jvm-opts could also be an option in aliases to reset the top level jvm opts

Alex Miller (Clojure team)12:03:20

The top level stuff is also used for -X calls

borkdude12:03:47

-X is made in the context of your project classpath, or am I missing something?

Alex Miller (Clojure team)12:03:46

I’m not sure if you mean that as a pro or con :)

borkdude12:03:12

What I mean is, when doing -X calls, why would you not want to have the top level jvm opts (if they were supported)

Alex Miller (Clojure team)12:03:44

Not sure, maybe you would

Alex Miller (Clojure team)12:03:20

I also do have an issue to do more validation of deps.edn against the specs, I just need to update some of those before I enable it

dvingo13:03:34

I brought this up two years ago.. https://clojurians.slack.com/archives/C6QH853H8/p1639018565012400 I don't really know what to say. It's obviously an issue other people keep running into.

borkdude13:03:15

@U051V5LLP I think it's good that you expressed your concern and there are issues in both tools.deps and clj-kondo about it. I'll try to get it into the new clj-kondo release, but I'm sure you are aware that each project has a backlog and it can sometimes take more than two years for an issue to be resolved because there are even more important issues to work on.

lvh13:03:40

I think the reason this one may be “special” is that Java library path is more like a class path than any other opt; in this case I definitely want it on by default for this project

borkdude13:03:55

Wasn't there also some global environment variable for this btw? CLJ_JVM_OPTS

lvh13:03:40

Maybe; I’ve been using JVM_OPTS directly since that also does what I want :D

borkdude13:03:05

CLJ_JVM_OPTS is only for classpath construction, not for the "app" itself

dvingo13:03:25

It's pretty obvious there are structural issues with the maintenance of these core projects. There's a long chain of great devs who have attempted to contribute to clojure and related core libs are now permanently absent from the community... It may seem like a digression, but the point is that if only one or two people can (practically, not technically) contribute to these core projects, they're just not going to get the attention they require for being core pieces of the clojure workflow. And the language and its community are suffering because of it. I think it's pretty cliché in the clojure community at this point, but that doesn't make it less frustrating. Again the point is that what a tool does says things about the people and community behind it regardless of the explicit words communicated. I know it's pointless to write these words as many before me have done the same to no avail, but, well, I'm frustrated with the clojure community and I think it can be useful for other people to hear that in the hope that it influences some positive changes.

borkdude13:03:57

there are pros and cons to how projects are managed

borkdude13:03:08

Coming in the release later today

dvingo11:03:43

I just wanted to say that the comment I left the other day was unproductive and wanted to apologize for it. The core desire is to see clojure grow, and I was frustrated from personal experiences of using clojure on projects with other developers (both new to clojure and experienced ones used to leiningen) who had a hard time dealing with the tooling around the language and I thought that if the tooling was made more user-friendly it could help grow the clojure community by making a positive first experience and nth experience for developers instead of one of frustration. The lack of basic error/syntax checking and reporting to users in tools.deps was one obvious way (to me) to do that, and the fact that it is unaddressed years later messages to me that this is not important as compared to other things. I know there is only so much time to get things done so the thought was that if the core were more welcoming to contributors then these sort of quality of life issues could be addressed more quickly, thus improving the experience of using clojure for everyone. However, like borkdude said, there are trade-offs in all things and I know this is the way clojure is managed and should not expect differently, but it is still frustrating when you see things that could be made better but are not, even if you understand why they are not. The desire is to help out but I know from the high profile exits of attempted clojure contributors that path is fraught. Hence the frustrated comment. Anyway, thanks for the continued work on the tooling, I'm sure it will improve over time and I know the best/only way out is through.

❤️ 2
Alex Miller (Clojure team)13:03:15

Providing better feedback is something we care about and looking back at the prior thread, I did do work at the time to update the specs but never got to the point of enabling it for validation. Because it was never logged it eventually fell off the plate in the usual deluge. Enhancement requests can be logged at https://ask.clojure.org and I sweep through those to make tickets at least once per week. We prioritize (partially) based on votes there. I do have a very recent ticket (https://clojure.atlassian.net/browse/TDEPS-238) that raised this again and when I next have time to work through tdeps issues it’s high on my list. I don’t think we have a good ask Clojure question related to this, so would be happy for you to write one so it can be voted on. I am happy to look at patches for stuff like this and anything else of course - we apply patches from contributors literally all the time all over the contrib projects. Re the so-called “high profile exits”, let’s just say that that summary is reductive and there’s a lot more nuance in what actually happened.

dvingo20:03:09

Thanks for taking the time to reply. Just posted a Q here https://ask.clojure.org/index.php/12803/tools-deps-perform-sanity-checking-on-deps-edn-file Good to know about contributions. I guess this is a grey area in community development about dealing with specific individual incidents. I specifically have in mind Tim, Zach, and Chas. All people who for many years gave a lot to the community and whose code and protocols we are still using daily. All of them had some sort of falling out that was so bad that they didn't just cut back contributing, but exited the community completely. As an outside observer it is not clear what happened and even after searching the internet for some clues it is still not clear, so all I can do is evaluate the facts that three high profile contributors all left the community after some unobserved interactions with the core team. From this vantage point in time it appears that these departures were brushed aside and largely ignored by the core team. (I don't see any public communication about what happened). As someone who wants clojure to succeed and tries to promote it to other developers it is very awkward when newcomers to the language ask what happened when they come across some old blog post or tweet about these events. I don't have an answer for them, and that led to my thoughts about contributions not being welcome. I know it can be awkward to talk about individual cases and circumstances but the lack of public communication about what happened is I think even more awkward and leaves a bad spot on clojure's history the way that unacknowledged scandals tend to in any domain. I see indirect mention to these departures in 5.3 of A History of Clojure, which from my reading, really only suggests further that you shouldn't waste your time trying to contribute to the core. I think those dramatic events of the past have helped to (painfully) align expectations about what clojure is and who it is for, but the indirect response to what happened is quite odd and I think makes the idea of wanting to contribute off-putting, but it seems like that might be by design. To be concrete, something along the lines of "some prominent contributors in the past had expectations which led them to have incorrect beliefs about the clojure contribution process, so to prevent that from happening again here are the changes that were made: xyz" I think would help provide some closure for remaining members of the community and prevent future reductive/inaccurate summaries of what happened.

borkdude20:03:17

I don't think everything has to do with trying to contribute to core and not getting patches accepted or so. Chas wanted to have static types and is now using OCaml. The same happened with Antonio Monteiro, heavy contributor to CLJS and author of lumo. Zach got into an interesting job at Microsoft (I believe) where he doesn't use any Clojure. Sometimes people just move on to the next thing. 🤷

borkdude20:03:43

I'm not saying that frustration with the contribution process doesn't have anything to do with it, but also it's probably not the whole story. But I also am an outsider to these things and don't know any details. FWIW

borkdude20:03:04

I've also seen people go away for 5 years and then take a peek back inside. The Onyx guy (Drogalis) went off to Confluence and kind of disappeared out of the clojure community for a while. Lately I spoke with him here again. These things happen.

borkdude20:03:10

Sorry, that was Confluent (Kafka)

dvingo16:03:59

Thanks for the reply and context borkdude. Having a lot of missing details makes it hard to discern what actually happened, but yea, that makes sense that the only constant is change and sometimes people move on.