Fork me on GitHub
#leiningen
<
2021-10-16
>
ericdallo23:10:43

Hello, I'm having issues making my plugin (`lein-clojure-lsp`) set a JVM opt, does anyone knows how to properly configure it? 🧵

ericdallo23:10:36

I want to make my plugin set "--add-opens" "java.base/java.nio=ALL-UNNAMED" , I already tried adding :jvm-opts ["--add-opens" "java.base/java.nio=ALL-UNNAMED"] to the plugin project.clj

ericdallo23:10:02

also, I tried adding that jvm opts to the project that is using the plugin as well and it didn't work

ericdallo23:10:32

the only way I got that to work is via the env var:

LEIN_JVM_OPTS="--add-opens=java.base/java.nio=ALL-UNNAMED" lein clojure-lsp clean-ns --dry 

ericdallo23:10:13

but that's not what I want since I want to add that jvm flag for all users of lein-clojure-lsp to avoid warnings like:

WARNING: Illegal reflective access by org.lmdbjava.ByteBufferProxy$AbstractByteBufferProxy (file:/home/greg/.m2/repository/com/github/clojure-lsp/clojure-lsp/2021.09.30-15.28.01/clojure-lsp-
2021.09.30-15.28.01.jar) to field java.nio.Buffer.address                                                                                                                                     
WARNING: Please consider reporting this to the maintainers of org.lmdbjava.ByteBufferProxy$AbstractByteBufferProxy                                                                            
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations                                                                                         
WARNING: All illegal access operations will be denied in a future release

ericdallo23:10:18

any suggestions?

vemv23:10:26

Yes, instead of doing it in project.clj, do it in the plugin ns its 'main' function receives a project map as data representing the end user's project, you can add the jvm opt there

ericdallo23:10:29

Oh, nice, I will try that, thank you @U45T93RA6!

ericdallo23:10:58

I just need to assoc JVM options including mine merging with the existing if any right

vemv23:10:06

guess so :)