Fork me on GitHub
#tools-deps
<
2021-04-22
>
borkdude09:04:41

In some situations like when using nil :classpath-overrides, the classpath can end up having empty paths in between like src::/home/russ/russmatney/ralphie/src:::/home/russ/.m2/repository/cheshire/cheshire/5.10.0/cheshire-5.10.0.jar. This has the effect that the local dir is added to the classpath. Demo:

echo '(ns foo) (prn :foo)' > foo.clj
clj -Scp ":$(clojure -Spath)" -M -e "(require 'foo)"
:foo
Is this a feature, or a bug?

borkdude12:04:20

Shall I put this on ask?

vlaaad12:04:04

that’s not really a demo though, you set empty folder on the classpath yourself and not using :classpath-overrides

borkdude12:04:09

I changed the title

borkdude12:04:37

When adding the current dir you should imo add . to the classpath

vlaaad12:04:51

isn’t it java behavior?

borkdude12:04:20

but maybe this is a behavior in Java indeed, it's nonetheless confusing

borkdude12:04:57

Maybe it should only be fixed on the level of classpath overrides etc though

borkdude12:04:34

In bb I made a workaround for this that just ignores all empty paths when searching on the classpath, when getting back such a classpath from the clojure tooling

borkdude12:04:15

The issue was that an uberjar built with bb that had such a classpath would add everything in the current dir to it

borkdude12:04:50

I added this note:

Maybe the empty paths returned from tools.deps.alpha should be fixed.
The empty path on the classpath behavior might be JVM behavior.

borkdude12:04:18

ok, edited the issue once more. please have another look