This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-19
Channels
- # announcements (6)
- # aws (10)
- # beginners (73)
- # bristol-clojurians (2)
- # calva (9)
- # cider (25)
- # clj-kondo (7)
- # clojure (160)
- # clojure-dev (2)
- # clojure-europe (63)
- # clojure-italy (7)
- # clojure-nl (10)
- # clojure-uk (76)
- # clojuredesign-podcast (6)
- # clojurescript (63)
- # cursive (6)
- # data-science (3)
- # datomic (26)
- # duct (59)
- # emacs (1)
- # fulcro (12)
- # graalvm (17)
- # hoplon (23)
- # jobs-discuss (2)
- # kaocha (6)
- # meander (7)
- # off-topic (3)
- # pathom (2)
- # rdf (68)
- # re-frame (12)
- # reagent (20)
- # reitit (5)
- # ring (3)
- # ring-swagger (1)
- # shadow-cljs (14)
- # spacemacs (10)
- # sql (3)
- # tools-deps (30)
- # yada (9)
Is there a way I can have my source code locally and edit it with emacs/cider, yet starting the java process on a remote machine?
@U7S5E44DB look at https://stackoverflow.com/questions/52459671/clojure-how-to-connect-to-running-repl-process-remotely
You could use this to start lein repl
on the remote machine and then cider-connect
:
# on remote machine
lein repl :start :port 40000
# on localhost
ssh -NL 40000:localhost:40000 username@host
# THEN: lein repl :connect OR cider-connet
lein repl :connect localhost:40000
Dev mostly on my laptop, but when doing some intensive computation spin up a remote instance from scratch and start a java process from there (using CIDER)
How are you going to "deploy" the program to the remote machine? Seems like pushing code there could be an option?
Yes indeed, I think that's the simplest solution to this, in which what you linked will help
If your remote machine has all the dependencies you need, then you don’t actually need to send your own source code. You can just connect to the remote REPL and start evaluating code.
That’s of course the whole point of this exercise; but you need the initial version to run Leon repo, I think
When I used to do this, both tramp (source+repl on the remote instance) and hybrid (local source + forwarded ssh port connected to the remote instance running a repl) worked fine. At the time I had to match the folder structure for "hybrid" to work properly, otherwise cider would try to find the source files using the remote's paths. Now there's a configuration option for that as well.
I have a small project using tools.cli (deps.edn) to manage dependencies and stuff. Running clj -A:test:runner
runs all of my unittests, but I can't convince cider that this project has any. In my leiningen projects, I've gotten to like running C-c , ...
to run my tests, but when I try that in cider for this project, I get errors about No test namespace
. Maybe I've configured something incorrectly? Does this work for someone else? Can you share a snippet of your deps.edn?
@eamonn.sullivan the simplest way is to add test
to your paths in deps.edn
and you dont need a specific alias, as the test path is always included
:paths ["src" "test" "resources"]
I think I do have that? That's why clj -A:test:runner
works, I thought. But my understanding of this is limited. What would I need to add to this?
CIDER will not use an alias unless you tell it to use it. The test path is only in an alias
Or, sorry, I see your paths bit. I missed that. Thanks!
Just added it. Ideally, you should add a .dir-locals.el
file that defines the alias you want to run
Or you can use C-u
(or SPC u
in Spacemacs) to edit the jack-in command when before it runs and add an alias to the start
see the bottom of this blog for more examples https://practicalli.github.io/blog/posts/cider-jack-in-to-clojure-cli-projects-from-spacemacs/
Well, just adding the test to the paths worked a treat. I'll look into .dir-locals.el if I need something more complicated. Thanks again!
you could just add a .dir-locals.el
to the root of your project with this in it
((clojure-mode . ((cider-clojure-cli-global-options . "-A:test"))))
And then all your test code is included via the alias. CIDER uses its own test runner, so you dont need the :runner aliasAdding tests to paths may include test code in other tasks, eg. like deployment, so probably the preferred solution long term (but a useful quick hack)