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?Bug
Shall I put this on ask?
Sure
https://ask.clojure.org/index.php/10512/current-directory-added-classpath-with-classpath-overrides
that’s not really a demo though, you set empty folder on the classpath yourself and not using :classpath-overrides
I changed the title
When adding the current dir you should imo add .
to the classpath
ah
isn’t it java behavior?
but maybe this is a behavior in Java indeed, it's nonetheless confusing
Maybe it should only be fixed on the level of classpath overrides etc though
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
The issue was that an uberjar built with bb that had such a classpath would add everything in the current dir to it
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.
ok, edited the issue once more. please have another look