I’m trying to make a custom lein task called migrate, so I can say on the command line:
lein migrate
lein finds my task file under src/leiningen/migrate.clj (as per the leiningen convention). In the ns declaration for the task I have a require for a file from my project
(ns leiningen.migrate
(require [triface.migration :as mm]))
(defn migrate []
(mm/run-migrations))
It finds src/triface/migration.clj fine, but THAT file requires a file that requires jdbc:
(ns triface.db
(:require [clojure.java.jdbc :as sql]))
This call works fine in my application, but from this lein task it fails with the following error:
Exception in thread "main" java.io.FileNotFoundException:
Could not locate clojure/java/jdbc__init.class or clojure/java/jdbc.clj on classpath
What is going on here? Thanks!
The classpath is slightly different.
To use it as is, you must define :dev-dependencies in your project.clj file.
For example,
Then, the jar file is loaded properly.