Fork me on GitHub
#cider
<
2019-09-29
>
deep-symmetry04:09:56

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.

deep-symmetry04:09:55

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?

deep-symmetry04:09:23

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?

deep-symmetry05:09:34

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

bozhidar06:09:31

I definitely can’t. I didn’t even know they had moved this out of the default list of modules.

bozhidar06:09:14

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.

bozhidar06:09:06

> 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?

bozhidar06:09:01

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.

cfleming09:09:22

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.

cfleming09:09:46

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.

cfleming09:09:39

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.

bozhidar11:10:52

@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. 🙂

deep-symmetry06:09:00

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.

deep-symmetry06:09:34

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.

deep-symmetry07:09:08

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.

deep-symmetry07:09:55

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.)

bozhidar17:09:04

Got it. Thanks for the follow-up!