This kills me... I cannot require anything other than built-in native deps. No hiccup, no http-kit etc... Even if I can find them on my hard drive in .m2/repository
lein new myapp
,
add [markdown-clj 0.9.91]
to project.clj,
add (ns metapp.core
(:require [markdown-clj :as mark]) )
lein run
Retrieving markdown-clj/markdown-clj/0.9.91/markdown-clj-0.9.91.pom from clojars
Retrieving markdown-clj/markdown-clj/0.9.91/markdown-clj-0.9.91.jar from clojars
Exception in thread "main" java.io.FileNotFoundException: Could not locate quote/markdown_clj__init.class or quote/markdown_clj.clj on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.,
lein deps
is not returning anything
Somebody knows what's wrong please? This stacktrace isn't very helpful, so Lein can fetch deps, but doesn't know how to require them?
EDIT: Running Linux Mint 18.0, clojure is in /home/denis/clojure-1.8.0
and is called by alias java -cp /home/denis/clojure-1.8.0/clojure-1.8.0.jar clojure.main
. Directory tree in myapp is /home/denis/prg/cljr/myapp
SOLUTION:
Thank you guyz, but now feel like an idiot.
So to summarize for future-comers, in project.clj, to ask for a dependency "X" doesn't mean you should "require" it as "X". You must require it the way the author specified in documentation, for example [http-kit "2.2.0"]
in project.clj is required as follows
(ns metapp.core (:require [org.httpkit.client :as http] )
.
Second, the way you require inside your code is not the same as the way you require in REPL, for example, this works in yourapp.core (require [stuff.core as stuff])
. You could also write it like this, it works too (ns yourns (:require [stuff.core :as stuff])
. But this synthaxe doesnt work: (:require [stuff.core :as stuff])
.
In REPL however, it's different story! I must use (:require '[stuff.core])
if it is an added dependency, or (:require 'clojure.string)
if it is a built-in library! Note that something like (require '[http.async.core])
doesn't work because it is not built-in. So if you checked the documentation https://clojuredocs.org/clojure.core/require which only shows built-in examples, like me, you are doomed.
Also for built-in library like clojure.string you can use simply (require 'clojure.string)
, yup, the one which didn't worked with dependencies. Have fun guys! LOOOOONNG journey ahead, clojure is only language so far I needed to spend 4 days figuring out how to IMPORT modules (poke Python, it only took 30 seconds), hope it worth it!