clj-on-windows

2023-05-08T16:13:40.694089Z

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 

2023-05-08T16:14:28.840529Z

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

borkdude 2023-05-08T16:15:14.443559Z

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

2023-05-08T16:15:42.501219Z

haha, was that me?

borkdude 2023-05-08T16:15:52.527439Z

oh that was probably you :)

borkdude 2023-05-08T16:15:59.546019Z

what answer did you get there then?

2023-05-08T16:16:48.161379Z

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

2023-05-08T16:18:10.516999Z

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.

2023-05-08T16:18:43.186109Z

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

borkdude 2023-05-08T16:21:01.773079Z

Have you tried :use-cp-file?

borkdude 2023-05-08T16:21:48.601519Z

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

borkdude 2023-05-08T16:22:51.782439Z

it could also be useful to get a hold of this file: https://github.com/clojure/tools.build/blob/f096376cd4e301dbf90ce447fee901397d3490c0/src/main/clojure/clojure/tools/build/tasks/compile_clj.clj#L105 and see what's in it

2023-05-08T16:25:19.201159Z

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

2023-05-08T16:26:46.863739Z

Haven't tried :use-cp-file

2023-05-08T16:29:05.954129Z

Do I change this to :always or :never?

2023-05-08T16:32:20.658209Z

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

borkdude 2023-05-08T16:32:55.044349Z

I think true?

2023-05-08T16:33:06.890429Z

I'm using clojure via scoop and bash.

borkdude 2023-05-08T16:33:36.888589Z

ah yes :always

borkdude 2023-05-08T16:33:43.315819Z

try that

2023-05-08T16:33:48.507799Z

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)

borkdude 2023-05-08T16:34:15.962619Z

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

borkdude 2023-05-08T16:34:23.865279Z

you can add a conflict handler for that

2023-05-08T16:34:39.567459Z

ahhh, yeah seen that too somewhere...

borkdude 2023-05-08T16:34:43.814359Z

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

2023-05-08T16:48:48.819879Z

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

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

borkdude 2023-05-08T17:15:53.932519Z

what about just ".LICENSE."`

borkdude 2023-05-08T17:15:59.075519Z

fucking markup

2023-05-08T17:19:35.682829Z

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

2023-05-08T17:25:06.323609Z

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

borkdude 2023-05-08T17:26:44.781909Z

i meant .*LICENSE.*

borkdude 2023-05-08T17:26:48.814819Z

but the markup fucked it up

2023-05-08T17:27:22.273639Z

ah

2023-05-08T17:31:08.396719Z

That did it!

2023-05-08T17:31:23.359409Z

Thanks!

borkdude 2023-05-08T17:32:51.854059Z

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

borkdude 2023-05-08T17:33:55.170529Z

A repro that people can readily clone and run will help

borkdude 2023-05-08T17:34:24.957829Z

Also specify Java version / vendor

2023-05-08T16:14:49.948989Z

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