cursive icon indicating copy to clipboard operation
cursive copied to clipboard

Unable to select aliases when importing deps project

Open cursive-ghost opened this issue 5 years ago • 2 comments

When importing a deps project, sometimes it's necessary to select an alias for the project to even resolve correctly. This can happen when using :override-deps or :default-deps. Without the alias applied, the project is essentially invalid and will not resolve. Cursive should probably present the aliases during project import so that the user can select them for the first project resolution.

cursive-ghost avatar Dec 16 '19 21:12 cursive-ghost

One minimal reproducer:

mkdir -p project/foo project/bar
echo '{:deps {}}' > project/bar/deps.edn
echo '{:deps {bar {}} :aliases {:default {:override-deps {bar {:local/root "../bar"}}}}}' > project/foo/deps.edn

(Other variants: use :deps {bar nil}, use :default-deps, define the :default alias in a $CLJ_CONFIG-accessible file instead of foo's deps.edn.)

If the default alias is unchecked in the clojure deps tool window, you will get this error when importing or syncing: Coordinate type not loaded for library bar/bar in coordinate {}

If the default alias is checked, you get a different error: Manifest type not detected when finding deps for bar/bar in coordinate {:local/root "../bar"}

clojure -Stree -A:default from foo works

favila avatar Dec 16 '19 21:12 favila

A workaround for the "Manifest type not detected" error is explicitly note the manifest type in your :default-deps or :override-deps, e.g. {:default-deps {bar {:local/root "../bar" :deps/manifest :deps}}}

favila avatar Dec 16 '19 22:12 favila

The approach that I've taken for this differs from what I expected to do. I had planned to show the available aliases during import and allow them to be selected, but this doesn't work with the quick project import which doesn't show a UI. So what I have done is to allow the invalid project to be imported, but ensure that the project's aliases are shown in the deps tool window even if the project resolution fails, which means the alias can be selected and the project refreshed to fix the problem.

cursive-ghost avatar Jul 19 '23 17:07 cursive-ghost

Fix released in 1.13.1-eap1 on 2023-07-24.

cursive-ghost avatar Oct 30 '23 02:10 cursive-ghost

Fix released in 1.13.1 on 2023-12-07.

cursive-ghost avatar Dec 07 '23 01:12 cursive-ghost