tools.deps.alpha cannot be used as a library from a process which does not have the CWD set to the directory containing the deps.edn file
Description
Environment
Attachments
- 27 Jan 2019, 02:43 AM
Activity
Howard Lewis Ship September 29, 2022 at 1:24 AM
I think this difference for me vs. https://clojure.atlassian.net/browse/TDEPS-74 is that I’m starting in the root directory, not a sub-directory, just for the purposes of this codox classpath stuff. I suppose another workaround would be to create a codox
sub-directory and execute there, so that relative directories work, but my ugly workaround (https://github.com/pedestal/pedestal/blob/942d14c38be7871fb12a21ab038a222ebc29668f/build/build.clj#L23) seems to be getting the job done.
Howard Lewis Ship September 29, 2022 at 1:19 AM
I’ve hit a similar issue, where I’m attempt to build a combined classpath for all sub-projects of pedestal, to generate Codox documentation at one go.
Manifest type not detected when finding deps for io.pedestal/pedestal.log in coordinate #:local{:root "../log"}
I believe it is because the current directory is the parent directory, and ../log is being evaluated there. I’ll look into using the dir/with-dir approach, but I think this should be properly handled by the library itself.
Alex Miller March 16, 2019 at 5:25 PM
Closing this with the suggested path in the comments from the TDEPS-74 changes, released in tools.deps.alpha 0.6.496. Reopen or file a new ticket if need to revisit.
Alex Miller March 15, 2019 at 11:50 PM
With most recent changes for TDEPS-74, there might be enough stuff to solve this when invoking the API by wrapping like this:
(require '[clojure.java.io :as jio]
'[clojure.tools.deps.alpha.util.dir :as dir]
'[clojure.tools.deps.alpha :as tda])
(dir/with-dir (jio/file "/path/to/dir")
(tda/resolve-deps ...as.before...))
@Colin Fleming wondering if that is sufficient for you? (I have committed but not yet released TDEPS-74 yet so could do that if it makes it easier to test.)
Matthias Margush January 27, 2019 at 2:43 AM
Here is a patch for further discussion.
It uses the following strategy:
1. When deps are read, each `:deps`, `:extra-deps`, `:override-deps`, and `:default-deps` is supplemented with `:deps/manifest-path`, which is the path to the `deps.edn` containing it.
2. The `:deps/manifest-path` is used to calculate the path to the dependency manifest file.
Details
Details
Assignee
Reporter
Priority

If tools.deps.alpha is used as a library from a process which does not have its CWD set to the directory containing the deps.edn file it's reading,
:local/root
deps do not work correctly. The paths from the dependency deps project (the one referred to using:local/root
) are returned as absolute paths calculated relative to the CWD of the process, not to the deps.edn file.This is a significant limitation. It makes use of t.d.a. very difficult from clients such as Cursive, and it means that a single process can never correctly read more than one deps.edn file, which seems like a very common use case.