Search code examples
clojureclojure-java-interopclojure-contrib

Problems while creating a deps.edn file


People, I decided to rewrite this post entirely to show it in a clear way.

First of all, thanks for all the support. I appreciate that.

This is the exercise in "The Clojure Workshop - Packt" where i've got stuck:

(My IDE is IntelliJ and i'm using Windows).

Exercise 4.10: Importing Data from a CSV File

1. Create a folder somewhere convenient on your computer.

I decided to create an entirely new project.

Is there any difference here while choosing between Leiningen or Deps? I most of the time use Leiningen, but should i use Deps because i am gonna use a deps.edn file?

2. Download the match_scores_1991-2016_UNINDEXED.csv file to the folder you created. (here on github)

But where should i download this file? Into the src file inside the project file or any file works? Is there any difference?

I decided to save inside de src.

3. In your editor, in the same folder, create a deps.edn file with the following contents:

{:deps
 {org.clojure/data.csv {:mvn/version "0.1.4"}
  semantic-csv {:mvn/version "0.2.1-alpha1"}}}

So, i created a deps.edn file.

4. Verify that everything is working by evaluating the following expression in your REPL:

user> (require '[clojure.data.csv :as csv])
nil
user> (require '[clojure.java.io :as io])
nil
user> (with-open [r (io/reader "match_scores_1991-2016_unindexed_csv.csv")]
         (first (csv/read-csv r)))

Created a new local Clojure REPL for this project.

But when i am gonna evaluate the testing expressions, it shows an error while evaluating the second one and third one.

As you can see here.

The error while evaluating the "clojure.data.csv :as csv" is this one:

Execution error (FileNotFoundException) at csv-example.core/eval1549 (form-init2604783929697477049.clj:1).
Could not locate clojure/data/csv__init.class, clojure/data/csv.clj or clojure/data/csv.cljc on classpath.

What am i missing? Have been trying for days to solve this but i didn't found any answer.

Thank you!


Solution

  • You can solve the problem by doing what Sean Corfield commented on the post if you choose to use deps.edn.

    Or, if you prefer leiningen you can solve that just by adding

    
    [org.clojure/data.csv   "1.0.0"]
    [semantic-csv           "0.2.1-alpha1"]
    
    

    at the :dependencies key inside the project.clj file.

    inside the project.clj file.