murtaza52
murtaza52

Reputation: 47441

ns error while compiling

I want to import dependencies in a function block. w These dependencies are not publicly available thus I cant include them through project.clj and require them in the ns block.

However these jars are available in the server env, and the server calls the below function when the below deps are in the classpath.

However when I compile the below function outside the server env, I still get compiler error that it is not able to find util and web ns.

(defn imm
  []
  (require '[immutant.web :as web]
           '[immutant.utilities :as util])
  (server/load-views (io/file (util/app-root) "src/pm/views"))
  (web/start "/dev" handler))

Upvotes: 1

Views: 72

Answers (1)

kotarak
kotarak

Reputation: 17299

You have to delay the Var resolution.

(defn imm
  []
  (require '[immutant.web :as web] '[immutant.utilities :as util])
  (server/load-views (io/file @(resolve 'util/app-root) "src/pm/views"))
  (@(resolve 'web/start) "/dev" handler))

Upvotes: 1

Related Questions