tools-deps

Discuss tools.deps.alpha, tools.build, and the clj/clojure command-line scripts! See also #depstar #clj-new
borkdude 2021-04-22T09:37:41.048600Z

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?

alexmiller 2021-04-22T12:24:31.048900Z

Bug

borkdude 2021-04-22T12:27:20.049200Z

Shall I put this on ask?

alexmiller 2021-04-22T12:29:11.049400Z

Sure

vlaaad 2021-04-22T12:34:04.049800Z

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

borkdude 2021-04-22T12:35:09.050Z

I changed the title

borkdude 2021-04-22T12:35:37.050200Z

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

vlaaad 2021-04-22T12:35:42.050400Z

ah

vlaaad 2021-04-22T12:35:51.050600Z

isn’t it java behavior?

borkdude 2021-04-22T12:36:20.050800Z

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

borkdude 2021-04-22T12:36:57.051Z

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

borkdude 2021-04-22T12:37:34.051200Z

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

borkdude 2021-04-22T12:38:15.051500Z

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

borkdude 2021-04-22T12:40:50.051700Z

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.

borkdude 2021-04-22T12:44:18.051900Z

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