This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-12-02
Channels
- # admin-announcements (29)
- # aws (11)
- # beginners (247)
- # boot (11)
- # business (1)
- # cider (73)
- # clara (5)
- # cljs-dev (37)
- # cljsrn (29)
- # clojure (86)
- # clojure-dev (9)
- # clojure-indonesia (1)
- # clojure-italy (3)
- # clojure-nl (1)
- # clojure-russia (195)
- # clojure-sg (2)
- # clojure-uk (3)
- # clojurecup (1)
- # clojurescript (296)
- # clojurex (2)
- # code-reviews (6)
- # core-async (3)
- # cursive (33)
- # datavis (9)
- # datomic (11)
- # funcool (31)
- # hoplon (1)
- # ldnclj (8)
- # lein-figwheel (5)
- # leiningen (5)
- # luminus (4)
- # off-topic (3)
- # om (172)
- # onyx (13)
- # re-frame (5)
- # reagent (84)
is there a way to compile the entire project? I keep having to go to each namespace and compile individually.
@roberto but there are tools that eagerly load your entire project as a side effect. Clj-refactor is one of them.
there’s also good old lein check
we have an app we make a jar out of and deploy. i’d like to be able to connect to an nrepl service we have in this app and enjoy the full CIDER experience. however, cider is a lein plugin. we don’t use lein to run this app. how would i include the cider nrepl middleware in the jar?
nevermind. rtfm!
thanks, will look into clj-refactor. So the issue I’m having, is that when I open a project (normally a web app), and want to start it up via the repl, it fails because it says it can’t find various namespaces. I then have to go and compile each namespace individually. But once the server is up and running, I can just compile the stuff I need and it will be hot loaded.
you might want to look into reloaded repl workflow and components. https://github.com/stuartsierra/component
so you would start the repl. run reset
which loads all your nses and starts up you webserver (and possible other related compnents of your system)
set-init!
is not part of tools.namespace
you should also see a list of reloaded namespaces in your repl most likely if refresh was run during reset
hmm, well it seems to do so https://github.com/weavejester/reloaded.repl/blob/master/src/reloaded/repl.clj#L53
indeed it does. but you said you needed to require reladed.repl’s reset?! so what kind of reset did you run before requiring it?
this is my repl, btw:
(ns repl
(:require [reloaded.repl :refer [system reset stop]]
[clojure.tools.namespace.repl :refer [refresh]]
[qfx-export.core :as q]
[environ.core :refer [env]]))
(def config {:client-id (env :client-id)
:client-secret (env :client-secret)
:oauth-domain (env :oauth-domain)
:oauth-callback (env :oauth-callback)
:oauth-url (env :oauth-url)
:oauth-profile-url (env :oauth-profile-url)
:oauth-token-url (env :oauth-token-url)
:port (env :port)})
(reloaded.repl/set-init! #(q/create-system config))
if this is reloaded.repl
’s reset
that should do the trick. you shouldn’t need to require refresh
...
can you show your project.clj? what is your source-paths and/or your dev-source-paths and where does the file live for your repl
namespace?
and this is the repl.clj
for this project:
(ns repl
(:require [reloaded.repl :refer [system reset stop]]
[clojure.tools.namespace.repl :refer [refresh]]
[zoom-recordings.server.core :as s]
[immuconf.config :as immuconf]))
(let [home-dir (System/getProperty "user.home")]
(reloaded.repl/set-init! #(s/create-system (immuconf/load "resources/config.edn"
(str home-dir "/.private/zoom-recordings/config.edn")))))
:reloading (zoom-recordings.server.db.setup zoom-recordings.server.s3 zoom-recordings.server.db.recordings zoom-recordings.server.routes.core zoom-recordings.server.core zoom-recordings.server.db.db-test-component repl zoom-recordings.server.db.fixtures zoom-recordings.server.db.setup-tests zoom-recordings.server.db.recordings-test)
:error-while-loading zoom-recordings.server.db.setup
#error {
:cause "No namespace: zoom-recordings.server.db.core"
:via
[{:type clojure.lang.Compiler$CompilerException
:message "java.lang.Exception: No namespace: zoom-recordings.server.db.core, compiling:(zoom_recordings/server/db/setup.clj:1:1)"
:at [clojure.lang.Compiler load "Compiler.java" 7239]}
{:type java.lang.Exception
:message "No namespace: zoom-recordings.server.db.core"
:at [clojure.core$refer doInvoke "core.clj" 4080]}]
:trace
so I think (not 100% sure) there are two problems here:
- your dev source-path points to ”dev”
and according what you said your repl.clj
is under "src/dev”
- but more importantly repl.clj won’t get loaded automatically, user.clj would because:
> You probably know that the Clojure REPL starts by default in the user namespace. In addition, if there is a file named user.clj at the root of the Java classpath, Clojure will load that file automatically when it starts.
the reason i placed it under a dev
dir outside the main code, is because I don’t want it in production.
hmmmm, changing to user.clj
doesn’t work either. But I think you are right. My repl.clj
or user.clj
isn’t being loaded.
When in doubt, it's AOT.
sorry for bothering you guys. I should have read the docs more carefully. The docs for tools that abstract tools.namespace
assume we know this.
btw, @stuartsierra thank you for the Readme in tools.namespace
You're welcome! Glad to hear it was helpful.