Fork me on GitHub
#beginners
<
2022-09-29
>
Thanh Nguyen08:09:47

I am trying to include a Git repository, using deps.edn. The REPL tells me that

2022-09-29 14:57:02.900:INFO::nREPL-session-3ca227b8-0702-4f72-8e40-837584052d45: Logging initialized @9646ms to org.eclipse.jetty.util.log.StdErrLog
Execution error (FileNotFoundException) at fabula.backend/eval1913$loading (backend.clj:1).
Could not locate ripley/html__init.class, ripley/html.clj or ripley/html.cljc on classpath.
What did I do wrong? I did include the link like this:
{:paths ["src" "resources"]
 :deps
 {org.clojure/clojure     {:mvn/version "1.11.1"}
  ring/ring-core          {:mvn/version "1.9.6"}
  ring/ring-jetty-adapter {:mvn/version "1.9.6"}
  compojure/compojure     {:mvn/version "1.7.0"}
  org.clojure/data.json   {:mvn/version "2.4.0"}
  ripley/ripley           {:git/url ""
                           :git/sha "bca327a81c0ee81a979a6bdeec533ea72483515e"}
  }}
I am using Intellij with Cursive and nREPL, if you need information. I also tried to use clj -Spom, and while the generated pom.xml includes libraries from Clojars, it does not include the library from Git. I am not sure if it is the reason and in the end, how to fix it

Ed09:09:00

I copied your deps.edn file and seem to be able to require the ripley.html namespace.

% clj
Cloning: 
Checking out:  at bca327a81c0ee81a979a6bdeec533ea72483515e
Downloading: ring/ring-jetty-adapter/1.9.6/ring-jetty-adapter-1.9.6.pom from clojars
Downloading: compojure/compojure/1.7.0/compojure-1.7.0.pom from clojars
Downloading: ring/ring-core/1.9.6/ring-core-1.9.6.pom from clojars
Downloading: commons-io/commons-io/2.11.0/commons-io-2.11.0.pom from central
Downloading: ring/ring-codec/1.2.0/ring-codec-1.2.0.pom from clojars
Downloading: ring/ring-servlet/1.9.6/ring-servlet-1.9.6.pom from clojars
Downloading: org/eclipse/jetty/jetty-server/9.4.48.v20220622/jetty-server-9.4.48.v20220622.pom from central
Downloading: org/eclipse/jetty/jetty-project/9.4.48.v20220622/jetty-project-9.4.48.v20220622.pom from central
Downloading: medley/medley/1.4.0/medley-1.4.0.pom from clojars
Downloading: crypto-equality/crypto-equality/1.0.1/crypto-equality-1.0.1.pom from clojars
Downloading: org/junit/junit-bom/5.8.2/junit-bom-5.8.2.pom from central
Downloading: org/testcontainers/testcontainers-bom/1.16.1/testcontainers-bom-1.16.1.pom from central
Downloading: org/infinispan/infinispan-bom/11.0.15.Final/infinispan-bom-11.0.15.Final.pom from central
Downloading: org/infinispan/infinispan-build-configuration-parent/11.0.15.Final/infinispan-build-configuration-parent-11.0.15.Final.pom from central
Downloading: org/clojure/tools.logging/1.2.4/tools.logging-1.2.4.pom from central
Downloading: http-kit/http-kit/2.5.1/http-kit-2.5.1.pom from clojars
Downloading: org/eclipse/jetty/jetty-http/9.4.48.v20220622/jetty-http-9.4.48.v20220622.pom from central
Downloading: org/eclipse/jetty/jetty-io/9.4.48.v20220622/jetty-io-9.4.48.v20220622.pom from central
Downloading: cheshire/cheshire/5.1.0/cheshire-5.1.0.pom from clojars
Downloading: org/eclipse/jetty/jetty-util/9.4.48.v20220622/jetty-util-9.4.48.v20220622.pom from central
Downloading: org/clojure/tools.logging/1.2.4/tools.logging-1.2.4.jar from central
Downloading: org/eclipse/jetty/jetty-util/9.4.48.v20220622/jetty-util-9.4.48.v20220622.jar from central
Downloading: org/eclipse/jetty/jetty-http/9.4.48.v20220622/jetty-http-9.4.48.v20220622.jar from central
Downloading: ring/ring-jetty-adapter/1.9.6/ring-jetty-adapter-1.9.6.jar from clojars
Downloading: commons-io/commons-io/2.11.0/commons-io-2.11.0.jar from central
Downloading: compojure/compojure/1.7.0/compojure-1.7.0.jar from clojars
Downloading: ring/ring-codec/1.2.0/ring-codec-1.2.0.jar from clojars
Downloading: org/eclipse/jetty/jetty-io/9.4.48.v20220622/jetty-io-9.4.48.v20220622.jar from central
Downloading: ring/ring-servlet/1.9.6/ring-servlet-1.9.6.jar from clojars
Downloading: org/eclipse/jetty/jetty-server/9.4.48.v20220622/jetty-server-9.4.48.v20220622.jar from central
Downloading: cheshire/cheshire/5.1.0/cheshire-5.1.0.jar from clojars
Downloading: crypto-equality/crypto-equality/1.0.1/crypto-equality-1.0.1.jar from clojars
Downloading: medley/medley/1.4.0/medley-1.4.0.jar from clojars
Downloading: ring/ring-core/1.9.6/ring-core-1.9.6.jar from clojars
Downloading: http-kit/http-kit/2.5.1/http-kit-2.5.1.jar from clojars
Clojure 1.11.1
user=> (require '[ripley.html])
WARNING: update-vals already refers to: #'clojure.core/update-vals in namespace: clojure.tools.analyzer.utils, being replaced by: #'clojure.tools.analyzer.utils/update-vals
WARNING: update-keys already refers to: #'clojure.core/update-keys in namespace: clojure.tools.analyzer.utils, being replaced by: #'clojure.tools.analyzer.utils/update-keys
WARNING: update-vals already refers to: #'clojure.core/update-vals in namespace: clojure.tools.analyzer, being replaced by: #'clojure.tools.analyzer.utils/update-vals
WARNING: update-keys already refers to: #'clojure.core/update-keys in namespace: clojure.tools.analyzer, being replaced by: #'clojure.tools.analyzer.utils/update-keys
WARNING: update-vals already refers to: #'clojure.core/update-vals in namespace: clojure.tools.analyzer.passes, being replaced by: #'clojure.tools.analyzer.utils/update-vals
WARNING: update-vals already refers to: #'clojure.core/update-vals in namespace: clojure.tools.analyzer.passes.uniquify, being replaced by: #'clojure.tools.analyzer.utils/update-vals
nil
user=> 
I don't think that a pom can contain a git dependency. I think that maven requires maven artefacts and doesn't know anything about resolving clojure tools deps dependencies, so I would expect it to not be included in a generated pom. If starting the repl from within cursive requires a pom, maybe you could start the nrepl server from a terminal and connect to it from within cursive? I'm afraid I don't know all that much about cursive.

👍 1
Thanh Nguyen10:09:37

@U0P0TMEFJ thanks! I tried to start a REPL for myself and hook Cursive's one into it, and it worked fine. I will try to report it to #cursive

👍 1
seancorfield15:09:46

FWIW, I think starting a REPL from the terminal and hooking into it from your editor is a better "pattern" for working anyway. I tend to leave my REPL running for days (or weeks) but my editors get restarted far more often.

👍 1
manu13:02:10

Hi! how can i include ripley with leiningen?

seancorfield18:02:53

Out of the box, you can't. You could try one of the git-related plugins for Leiningen, such as https://github.com/reifyhealth/lein-git-down @U38C71QAH (or you could switch your project over to deps.edn and the official Clojure CLI).

👍 2
Mobe17:09:46

Some advice regarding libraries needed: I want to scrape data off from a web site and store it locally…. as a toy project and to learn clojure… should I stick with apache http client and jsoup for now or would you recommend a more clojury library as replacement? How about storing / querying data? thx!

Ben Sless17:09:25

If you're just reading data, slurp the URI

Mobe17:09:35

it’s not really a site meant to be slurped 🙂 so yea I will have to do quite a bit of parsing to isolate the bits I need. I would also have to follow links that lead to other pages so forth..

Mobe17:09:22

(let’s say it is a toy project but with a specific purpose in mind )

dpsutton17:09:15

usually preferrable to find the api that the site itself uses and use that if possible

emccue17:09:17

hato + jsoup

emccue17:09:54

or yeah slurp a uri + jsoup

emccue17:09:04

(didn't know about that)

Mobe17:09:06

@U11BV7MTK it’s a regular website https://www.parfumo.net/Perfumes/Xerjoff/white-on-white-one I go with slurp + jsoup. merci