Skip to content

mikroskeem/nrepl-bridge

Repository files navigation

nrepl-bridge

Build Status

Java library to control nREPL launch from Java code

Why?

Because

NreplBridge bridge = new NreplBridge();
bridge.bootServer("127.0.0.1", 1337);

is way better than invoking Clojure code directly to achieve the same.

What about custom handlers?

Don't worry, I got you covered. You can pass handler function reference or symbol name as a string (it'll get dereferenced via (symbol <handler>))

bridge.bootServerWithHandler("my.namespace/cool-nrepl-handler", "127.0.0.1", 1337);

Help! Cider does not work!

I know, here's a workaround:

String ciderBoot = "(ns user-cider-fix)" +
        "(defn cider-nrepl-handler []" +
        " (require 'cider.nrepl)" +
        " (ns-resolve 'cider.nrepl 'cider-nrepl-handler))";
Compiler.load(new StringReader(ciderBoot));
Object ciderHandler = RT.var("user-cider-fix", "cider-nrepl-handler").invoke();
bridge.bootServerWithHandler(ciderHandler, "127.0.0.1", 1337);

Best I could come up with right now, sorry. Ideally this should be provided as an utility function (TODO)

License

Copyright © 2019 Mark Vainomaa

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

Releases

No releases published

Packages

No packages published