Hi! I’m having this issue https://github.com/clojure/tools.deps.alpha/wiki/clj-on-Windows#long-classpath is there any other workaround besides the {:mvn/local-repo "/path/to/repo"}
one? That is not working either
@jplaza Hmmm. You could spit out the classpath to a file and then start Clojure using java -cp @classpath-file clojure.main
but this is a bit spartan maybe.
there is a ticket with some work on it but I don't know that they are workarounds currently
I tried the @$CpFile
suggested and seemed to work. Added a sample diff here: https://github.com/clojure/brew-install/pull/4#issuecomment-728905508
Doesn't check the Java version though so would need something extra for Java 8 (if needed).
borkdude@MBP2019 /tmp $ clojure -Spath > classpath
borkdude@MBP2019 /tmp $ java -cp @classpath clojure.main
Clojure 1.10.1
user=>
What this does: java reads the classpath from a file here.
Tools.deps / clojure CLI might leverage the same workaround
seems like it could easily do so since it always has a classpath file already :)
yeah
this would actually be trivial
if you wanted to hack your ClojureTools.psm1 and try it
basically where you have -classpath $CP
if you changed that to "@$CP"
(probably not the right syntax but that's the idea) in like line 396
$CP here is the name of a classpath file
the exec case is maybe the hardest as it adds the special exec jar: -classpath "$CP;$InstallDir/exec.jar"
so might need to emit a well-known variant for that case or something
if someone wanted to work on a patch, would be happy to integrate that
you would have to append $InstallDir/exec.jar to the classpath file and then read that. Probably better to append it to some other file classpath-exec
and then use that one
afaik you can only use one @
and not in combination with non-file classpath
yes that would be my expectation. I'm suggesting that right now we write 12341234.cp and we could also write 12341234-exec.cp (which included the exec jar) and use that instead for the -X case
yes
You might want to check compatibility of this over several java versions
The java
docstring doesn't mention this explicitly
been around for a long time
if it works on Java 8, then it's ok by me :)
> been around for a long time where do you find docs about this?
looks like maybe java 9?
I'll try java 8
nope, didn't work
def doc'ed here https://docs.oracle.com/javase/9/tools/java.htm
I think maybe it was added in java 9 based on my googling. I thought it was older than that
well, could make it version dependent - if java version is 9+, use @
Right, it seems the @argument file thing applies to every option
or maybe invert, if Java version is 8, don't use @
Yeah, that makes sense. That will assume you will not re-use your cache for different java versions, so maybe include the java version in the cache hash if you haven't already
I don't think you need that
the files are the same either way, it's just whether or not you can use it via @
right. how will the CLI know which java version is used?
by calling java -version ?
$ time java -version
java -version 0.07s user 0.06s system 94% cpu 0.136 total
what's the error if you use the @file on java 8?
$ java -cp @classpath clojure.main
Error: Could not find or load main class clojure.main
not too distinguishable then
Maybe this can be controlled via an environment variable
I was wondering if you could just assume it would work, detect the failure and retry
CLOJURE_CP_FILE=true
yeah, it could be an env var too. I was trying to avoid that :)
might be the cleanest though
for those experiencing this problem, they would set it, others won't
that's fine
and only on Java 9+.
@jplaza what Java version are you using?
@alexmiller alternative dirty workaround: use add-lib to load the libs later on ;)
bleh
yeah, I said dirty, but it's always good to list alternatives, even when they're bad ;)
another alternative: won't fix until Java 8 isn't supported anymore :)
who knows if that day will ever come
another alternative: reverse engineer the java command line tool and build a nicer front-end which supports this for older java versions ;)
Thanks for the fast reply @alexmiller @borkdude! I’m helping a teammate with that issue. She has java 9.
I told her the problem is that she’s using Windows haha! She’s installing Windows Subsytem for Linux
as a quick workaround: https://clojurians.slack.com/archives/C6QH853H8/p1605552978403300
this isn't Windows's fault, more or less java's. No sorry, it's Window's fault ;)
😆
> Windows command-line length limit Does this apply to cmd.exe, powershell.exe or is it a conhost limit? Do you experience the same problem with the new Windows Terminal?
Not sure but happens with both cmd and powershell
wsl2 is pretty good ;)
Yeah, I gave up on the whole Powershell thing and just do everything on WSL2 now. Esp. with VS Code's Remote-WSL2 extension.
(I run VcXsrv aka Xlaunch so I can start X11-based GUIs from WSL2, such as REBL or Reveal)
Have you also tried portal btw?
Yes, but I prefer to dock a GUI next to my editor rather than switch back and forth between an editor and a browser.
Cool! Any tips on using Calva + WSL2?
@jplaza I use Clover with VS Code. I like working with a plain Socket REPL in processes -- I avoid nREPL and all that stuff. Clover is "Chlorine for VS Code" and I was previously using Chlorine on Atom.
OK I will try that. I already cloned your deps.edn https://github.com/seancorfield/dot-clojure to play with the sock repl
@jplaza Many people use Calva. Check out #calva. There's a lot going on there.
@jplaza Also check out out the clj-kondo plugin for VScode </shameless-plug>
I assumed clojure -X:deps mvn-pom :lib 'foo/bar' :version '"0.0.1-SNAPSHOT"'
would generate generate me a POM with the specified details but I’m not having any luck - I just get defaults. (Maybe mvn-pom
doesn’t pass the args on through to sync-pom
?). Was this not an intended usage? Or am I missing something? Or just an oversight?
it does not pass those through right now
mvn-pom may go away in favor of tools.build once that is out so I'm resisting the urge to make it better
understood, thanks
In the mean time you might try this: https://github.com/rickmoynihan/pom-update
hot off the press so YMMV, I’ve not even properly announced it yet.
Thanks - works for me if I generate the POM with tools.deps then update the version with pom-update. I needed to add :pom/write-strategy :overwrite :pom/input-file '"pom.xml"'
explicitly though.
oh yes thanks that’s intentional, I just forgot to add that to the README.md when I wrote it up last night. I’ll do that now. Thanks for letting me know.
Fixed.
My recommendation is that you include those in your deps.edn
rather than via command line, as they won’t vary across calls.
See the updated README.md
@jplaza if you find out stuff about using WSL2 with Calva, please consider updating this page: https://calva.io/wsl/
We use clj-kondo in our team! Awesome tool! I actually mentioned our startup in the issue so you can list us there 😉
Will do