Saturday, April 4, 2015

Start lein repl with test profile

When you try to run lein repl with test profile, you'll get warning/error message similar to this.
$ lein with-profile test repl
Warning: no nREPL dependency detected.
Be sure to include org.clojure/tools.nrepl in :dependencies of your profile.
Error loading Could not locate clojure/tools/nrepl/server__init.class or clojure/tools/nrepl/server.clj on classpath: 
Error loading complete.core: Could not locate complete/core__init.class or complete/core.clj on classpath: 
Exception in thread "main" java.lang.ClassNotFoundException:, compiling:(/private/var/folders/7d/98yf91rn0yz6wbh56h5q7rkh0000gn/T/form-init2792809345387087761.clj:1:1340)
The reason is because unlike default profile, tools.nrepl isn't added as dependency for test profile. You can verify this by comparing the output between lein pprint (or lein with-profile default pprint) and lein with-profile test pprint.

To fix this error, you can use the feature that lein provided combining profile like so;
$ lein with-profile default,test repl
With the command above, lein should start the repl without any errors.


firesofmay said...

Or you can do this instead

$ lein with-profile +test repl

Tap said...

Cool. Thanks firesofmay

[PostgreSQL] How to create read-only standby replica (follower)

This link  and this link explain it really well and concise