0
votes

New to Clojure and have been using Leiningen to manage my Clojure project.

I want to connect to a Couchbase bucket so I included:

[couchbase-clj "0.2.0"]

in my project.clj as stated in the GitHub Repo https://github.com/otabat/couchbase-clj

I also ran:

lein deps

to install my dependency, although the Leiningen guide states it will download the dependency automatically if I don't. https://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md#dependencies

So I have to following code in my core.clj

(ns first-app.core
(:gen-class :main true ))

(:require [couchbase-clj.client :as c]))

(c/defclient client {:bucket "subgate"
                 :uris ["http://127.0.0.1:8091"]})

(defn -main
  "I don't do a whole lot ... yet."
  [& args]
  (println "Hello, World! "))

But when I run:

lein run 

I get the error:

Exception in thread "main" java.lang.ClassNotFoundException: couchbase-clj.client, compiling:(first_app/core.clj:4:3)

Here is my dependency tree:

 [cider/cider-nrepl "0.8.1"]
 [cljs-tooling "0.1.3" :exclusions [[org.clojure/clojure]]]
 [compliment "0.2.0" :exclusions [[org.clojure/clojure]]]
 [org.clojure/java.classpath "0.2.0" :exclusions [[org.clojure/clojure]]]
 [org.clojure/tools.namespace "0.2.5" :exclusions [[org.clojure/clojure]]]
 [org.clojure/tools.trace "0.7.8" :exclusions [[org.clojure/clojure]]]
 [org.tcrawley/dynapath "0.2.3" :exclusions [[org.clojure/clojure]]]
[clojure-complete "0.2.4" :exclusions [[org.clojure/clojure]]]
[couchbase-clj "0.2.0"]
[com.couchbase.client/couchbase-client "1.3.2"]
     [commons-codec "1.5"]
     [io.netty/netty "3.5.5.Final"]
     [net.spy/spymemcached "2.10.5"]
     [org.apache.httpcomponents/httpcore-nio "4.3"]
     [org.apache.httpcomponents/httpcore "4.3"]
     [org.codehaus.jettison/jettison "1.1"]
     [stax/stax-api "1.0.1"]
 [org.clojure/data.json "0.2.4"]
 [org.clojure/clojure "1.8.0"]
 [org.clojure/tools.nrepl "0.2.12" :exclusions [[org.clojure/clojure]]]

Any tips are welcome as I am new to Clojure! Thanks In advance.

1

1 Answers

0
votes

Had to include my require before the ns delimiter.

(ns first-app.core
    (:gen-class :main true )
    (:require [couchbase-clj.client :as c]))

Special thanks to moxaj on Reddit