clj-on-windows 2023-05-08

I'm getting this error during compilation (compile-clj) and it only happens when I depend on maven dependency that has lots of transitive dependencies. I thought it could be the long classpath issue so I tried adjusting my maven-local to something shorter on a different drive (D). However it is still looking for some main class on my C drive:

Error: Could not find or load main class Dumais\AppData\Local\Temp\compile-clj15644282254864761747\compile-clj;target.classes;src;C:\Users\Paul
Caused by: java.lang.ClassNotFoundException: Dumais\AppData\Local\Temp\compile-clj15644282254864761747\compile-clj;target/classes;src;C:\Users\Paul
Execution error (ExceptionInfo) at clojure.tools.build.tasks.compile-clj/compile-clj (compile_clj.clj:114).
Clojure compilation failed, working dir preserved: C:\Users\Paul Dumais\AppData\Local\Temp\compile-clj15644282254864761747 

It seems to have an issue with the space in my home directory name.

I've heard about this issue recently in #tools-deps or #tools-build as well. Maybe it helps looking in there as well

oh that was probably you :)

what answer did you get there then?

Nothing yet, but then I went down a different path and back again - so I got help on the second issue.

At first I was going to launch clojure code via java in an existing app, but then thought a separate app that uses the java app as a dependency would be easier.

Hence I'm back to trying to make an uberjar using tools.build.

Have you tried :use-cp-file?

I'm suspecting it's a Windows specific escaping issue with how tools.build calls process builder (which I've accounted for in babashka.process when I ran into that) but I'm not sure. :use-cp-file may help

I find it interesting that running clj -P is now downloading a bunch of dependencies that it didn't do before trying to compile.

Haven't tried :use-cp-file

Do I change this to :always or :never?

Tried always but that didn't work. Trying never...

I think true?

I'm using clojure via scoop and bash.

ah yes :always

hmmm, now I get:

Execution error (FileNotFoundException) at java.io.FileInputStream/open0 (FileInputStream.java:-2).
C:\Users\Paul Dumais\AppData\Local\Temp\uber10211030562887780850\LICENSE (Access is denied)

This has come up before in #tools-build: sometimes a dependency has a LICENSE directory but another has a LICENSE file

you can add a conflict handler for that

ahhh, yeah seen that too somewhere...

but this is a good sign, it's getting further now

Hmm, tried putting in this as an option to compile-clj but no joy so far:

:exclude [#"(?i)^META-INF/LICENSE/.*"
                            #"^LICENSE/.*"]

what about just ".LICENSE."`

fucking markup

I had the options in the wrong part - trying it in b/uber

Ok, added #".LICENSE." , but that didn't work either.

i meant .*LICENSE.*

but the markup fucked it up

You may want to report your first issue before :use-cp-file in #tools-build though, I think I know the root cause but it's better if it got solved properly. I think clojure.java.process in 1.12 will suffer from the same issue actually

A repro that people can readily clone and run will help

Also specify Java version / vendor

But maybe that's not the root of the issue - not sure.