is it necessary to include clojure as a dep in the deps.edn? I've seen a few projects with it included.
There was a news-and-articles by daniel janus recently about this
ooh. ta.
Yes, but it is included by default
So I guess no :)
My personal thoughts are that you should mark your minimum required version. Because if you don't update your computer (for some reason) and then rock up on a project using Clojure 1.22 features, and you've got 1.15 you'll be scratching your head for a while. One less thing to manage externally.
It's more to do with docker containers. If I can remove the dependency (as it's already there as part of openjdk-11-tools-deps-slim-buster
), then I can remove it from the deps.edn file, thus making the binary ever so slightly smaller.
Hmm, I think you'll only get one copy either way...
you need to have it, and you will via the install deps.edn, it's just a question of version
Maybe by removing it, you're just forcing to match the version in your docker.
Probably safer to leave it in.
After all, storage is cheap š
Hello, I've seen examples of installing dependencies using clj -Sdeps '{:deps {bidi {:mvn/version "2.1.6"}}}'
but I was wondering if it's possible to instruct clj
to install dependencies listed in deps.edn
without doing anything else? Similar to lein deps
I suppose.
clj -Spath
as an option. it will download dependencies and print out calculated class-path
I think I've seen clj -e nil
given as a quieter example.
I've used clj -e :deps-download-complete
when building Docker images
is there a way via clj
to see all available aliases?
Not currently. Iāve been thinking about adding thAt
np, thanks
I apologize for the probably FAQ, but I have searched for thisā¦ when I specify a gitlib as a dependency, is there a way to specify the path within the gitlib to the source code? e.g. thereās a dep Iād like to use which has its Clojure code in src/clj/
@aviflax š That would be :deps/root :)
https://github.com/roman01la/uix see an example in UIx
š Hi Dominic, thanks!
I saw :deps/root
in the docs, but the description therein says:
> Specifies the relative path within the root to search for the manifest file.
In the case of this particular dep, the manifest file doesnāt even really existā¦ Iām faking it by manually setting :deps/manifest
to :deps
, to finagle tools.deps
into treating this dep as if it has an empty deps.edn
, which works in this case because the dep has no dependencies itself.
Anyway, thatās why I didnāt try it, but it makes sense that it would also change how the lib is added to the classpath. Iāll try it. Thanks!
Hmm thatās not quite working. I set :deps/root
to src/clj
but the path added to the classpath is /src/clj/src
š
Oh I see "to the source code". Yeah, that makes sense. I'm not sure you can get away with that.
I figured. I kinda wish there was a way to override that src
segment that tools.deps adds to the end of the root. Something like :deps/code-path
or something.
It would probably be :deps/paths or something :).
Thanks for the link, but Iām not really understanding that function. I think youāre pointing out that there isnāt currently a way to do this?
I was thinking maybe :deps/paths
but Iām not sure about the plural part. Iām not sure it makes sense to add multiple entries to the classpath for a dep.
:deps/root
Tried that already.
Doesnāt work in this case, see above.
@aviflax I am saying there's no way to do this currently :)
Yup, got it. Thanks though!
I guess Iāll open a ticket/issue as a feature request, couldnāt hurt.
I think this already does what you want
Oh! What am I missing?
or rather let me back up...
what kind of project is the git dep?
what kind of manifest file (pom, lein, deps)
project.clj
but it has no deps
so Iām specifying :deps/manifest
as :deps
that should just work - what doesn't work?
In the depās dir structure, the Clojure code is inĀ `src/clj/`
ah, ok
I tried settingĀ `:deps/root`Ā toĀ `src/clj`Ā but the path added to the classpath was thenĀ `/src/clj/src`
yeah, there is no way right now to externally set a git dep's paths
ah, ok
would a ticket be helpful?
sure
š
you coudl fork it and add a deps.edn though
ah, good point. Maybe I will. Thanks!
or clone and do the same with a local project
I was thinking maybe Iāll open a PR to contribute the deps.edn
to the main project; Iād rather not use a fork indefinitely
or that
I posted the request as a question to ask as that seems to be the preferred way to suggest an issue these days: https://ask.clojure.org/index.php/9314/is-it-possible-to-override-the-paths-of-a-git-dep
I think the question presupposes the need to do this, but maybe the broader request is about supporting lein projects
yeah
agreed!
or even more broader, supporting extensible project types, one of which could be lein
tools.deps is actually written to support this but clj does not expose that capability currently (b/c there are a lot of questions about how to do it well)
I can see it being a kind of support nightmare
Iām sure a million edge cases would pop up
maybe once tools.deps drops the āalphaā ā then there could be a subsequent alpha/beta/whatever release that would enable the feature, with the caveat that itās unstable, only for testing, etc?
Thanks for the suggestions, that's really helpful. My use case is also for building Docker images.