leiningen - Clojure: lein task cannot find jdbc, even though application can find it fine -


i'm trying make custom lein task called migrate, can on command line:

lein migrate 

lein finds task file under src/leiningen/migrate.clj (as per leiningen convention). in ns declaration task have require file project

(ns leiningen.migrate   (require [triface.migration :as mm]))  (defn migrate []   (mm/run-migrations)) 

it finds src/triface/migration.clj fine, file requires file requires jdbc:

(ns triface.db   (:require [clojure.java.jdbc :as sql])) 

this call works fine in application, lein task fails following error:

exception in thread "main" java.io.filenotfoundexception:  not locate clojure/java/jdbc__init.class or clojure/java/jdbc.clj on classpath 

what going on here? thanks!

the classpath different. use is, must define :dev-dependencies in project.clj file.

for example,

:dev-dependencies [[org.clojure/java.jdbc "0.0.4"] ] 

then, jar file loaded properly.

(ns triface.migration   (:require [clojure.java.jdbc :as sql]))   (defn run-migrations[]    "hello") 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -