This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-09-29
Channels
- # aws (2)
- # babashka (2)
- # beginners (86)
- # calva (1)
- # cider (17)
- # clojure (46)
- # clojure-conj (1)
- # clojure-nl (1)
- # clojure-uk (6)
- # clojurescript (8)
- # clojutre (2)
- # cursive (3)
- # data-science (1)
- # datascript (5)
- # datomic (1)
- # fulcro (9)
- # funcool (5)
- # jackdaw (1)
- # leiningen (6)
- # pathom (2)
- # re-frame (2)
- # rewrite-clj (2)
- # shadow-cljs (19)
- # spacemacs (12)
- # sql (2)
- # vim (26)
I have this crazy Clojure project, beat-link-trigger, which is luring an interesting set of people to learn a little Clojure so they can create crazy integrations as part of their DJ shows. But when people want to go beyond one-liners they copy and paste form my user guide, it is quite painful today, because the embedded editor that I can offer is very limited. Some syntax coloring, and that’s about it. So I am working on embedding an nREPL
server so people can use CIDER or Cursive to get a much nicer Clojure experience as they are tinkering.
Following the CIDER docs, I almost got it working, but it turns out that if you are in Java 11, you need to explicitly specify -add-modules jdk.javadoc
or the cider-nrepl handler crashes because it is trying to access doclet classes that are not available by default. This means that I can’t offer a simple double-clickable Jar file any more, and I need to figure out what to do about my JDK-embedded native Windows and Mac apps as well. Is this a known issue, and are there any plans to remove this dependency or make it fail more gracefully when the javadoc module is not available?
And a more fundamental question, is adding the cider-nrepl handler safe for situations when CIDER is not being used, such as if someone is connecting via Cursive instead? Or do I need to make that a user-configurable choice?
I opened an issue about the module dependency, but can anyone answer my question about injecting cider-nrepl and having other editors connect? https://github.com/clojure-emacs/cider-nrepl/issues/651
I definitely can’t. I didn’t even know they had moved this out of the default list of modules.
Probably we can make this optional, but it will break the javadoc related functionality. It’s strange I can’t see anything in the changelog for JDK 11 about this module.
> And a more fundamental question, is adding the cider-nrepl handler safe for situations when CIDER is not being used, such as if someone is connecting via Cursive instead? Or do I need to make that a user-configurable choice?
In theory it is, but it really depends on how the client is implemented. As long as it doesn’t throw some errors on receiving unknown messages, everything should be good.
I’ve found this not to be the case, and several times I’ve had to get users to remove CIDER middleware to make their projects work with Cursive. I generally don’t enquire much about whether it previously worked with CIDER or not, so it may just be that those projects are borked, I’m not sure.
Here’s an example from the other day, this was on reading a lein project:
Error reading /Users/andrew/IdeaProjects/trying-clojure/project.clj
Syntax error compiling at (cider/nrepl.clj:1:1).
Could not locate clojure/tools/nrepl/server__init.class, clojure/tools/nrepl/server.clj or clojure/tools/nrepl/server.cljc on class path.
The CIDER middleware often seems to cause problems reading the lein projects in Cursive, it’s not so much once the project is actually working.
@U0567Q30W The error you’ve mentioned seems like a standard dependency issue - either old nREPL and new cider-nrepl or the other way around. I was speaking in terms of the nREPL interface provided by cider-nrepl. Dependency issues are dependency issues and have nothing to do with it. 🙂
Thanks. I think what I will do for now is give the use the option of trying to load cider-nrepl
but refusing to launch the nREPL server if they request cider-nrepl
and the doclet classes are missing (I can just use reflection to check that at runtime). Then I can give them an error about needing to run with the -add-modules
argument and a link to some help about it.
The plot thickens… Even under JDK 11, if I run my project via Leiningen (and cider-jack-in), this package is available. But when I run it as an überjar by double-clicking (or java -jar), then it isn’t.
Ok, I closed the issue, it is looking more like a problem with the jar launcher on my Mac than with cider-nrepl. Sorry about the false alarm.
As of JDK 11, the concept of users double-clicking on a Jar file to run a program is dead anyway, so I will have to update my instructions. (I provide native installers for Mac and Windows anyway, so unix people will just have to use the command line.)