Welcome! Please see the About page for a little more info on how this works.

0 votes
in Calva by
closed by

Hi, I am new to Clojure and am following this tutorial to make a Clojure API. This uses Cursive plugin in IntelliJ, but I am using Calva in VS Code.

This is my project structure:

 .
├── deps.edn
├── resources
│   └── config.edn
└── src
    └── clojure_api
        ├── config.clj
        └── core.clj

My config.clj file contents:

(ns clojure-api.config
    (:require [aero.core :as aero]
            [clojure.java.io :as io]))

(defn read-config []
  (-> "config.edn"
      (io/resource)
      (aero/read-config)))

I changed my deps.edn file to add the paths src & resources like this:

{:deps {aero/aero {:mvn/version "1.1.6"}} :path ["resources" "src"]}

while keeping the config.edn file an empty map: {}. However, I could not read the config file from read-config function in config.clj. It gave this error in Calva repl:

; Execution error (IllegalArgumentException) at aero.core/read-config-into-tagged-literal (core.cljc:194).
; Cannot open <nil> as a Reader.

The tutorial solved this error in Cursive by refreshing the project structure. I cannot seem to find any such commands in Calva. How can I update/refresh my project structure in Calva so that the deps.edn changes are reflected in the repl?

I have tried to restart the repl, reopening the folder in VS code, shuffling the resources directory around to no avail.

I could not find related answers to this problem after googling, so any help will be appreciated.

closed with the note: Found the answer, which was just a typo.
by
Careless as I am, I had made an typo in my deps.edn file.
It should have been 'paths', not 'path'. Correcting it solved the problem.
by
There is no command in Calva for reloading the project. With Clojure 1.12, add-libs can be used for loading a  library into the project dynamically. Generally it is what you tried to do, restarting the REPL. But of course, the project files need to be fine . I see that you found the issue there.
...