Syntax error (ClassNotFoundException) compiling at (deps.edn:0:0). JSON Clojure error

149 Views Asked by At

I am trying to use the JSON library on clojure, but I am not able to install it, and I instead get the

[org.clojure/data.json "2.4.0"]
Syntax error (ClassNotFoundException) compiling at (REPL:0:0).
org.clojure

error message, I am using IntelliJ IDEA and I created a Deps project with this structure, in the deps.edn file I have:

{:paths ["src"]
 :deps  {org.clojure/spec.alpha {:mvn/version "0.3.218"}}}
 {:deps {org.clojure/test.check {:mvn/version "1.1.0"}}}
 {:deps {org.clojure/data.json {:mvn/version "2.4.0"}}}

But when I evaluate the {:deps {org.clojure/data.json {:mvn/version "2.4.0"}}} line in the terminal, I get the error message that I previously showed.

I dont have any plugin or whatever, I write the code on the IDE and then I run the clojure command on the terminal and evaluate the code I just wrote. Maybe that is the cause of the issue?

I found this, this and this sites but somehow they don't work for me. Thanks if you can help.

1

There are 1 best solutions below

2
On

The deps.edn file is a map, and in a map, you can have any number of distinct keys. A deps.edn file has a structure as follows:

    {:paths ["path1" "path2" ..]
     :deps { deps1
             deps2
             ... }
     :aliases {
       :alias1 {}
       :alise2 {}
       ...
     }
    }

And in your case, it will be as follows:

 {:paths ["src"]
  :deps  {org.clojure/spec.alpha {:mvn/version "0.3.218"}
          org.clojure/test.check {:mvn/version "1.1.0"}
          org.clojure/data.json {:mvn/version "2.4.0"}}}