How to use Boot's pods outside of Boot?

Howdy! I’m attempting to use Boot’s pods feature from within a standalone project that doesn’t involve Boot, and am encountering trouble.

Given the following segment:

(require '[boot.pod :as pod])
(let [p (pod/make-pod {})
    cmds '[(def x 3) (+ x 9)]]
  (pod/with-eval-in p ~cmds))

within Boot’s repl, this produces:

$ boot repl
    ... elided ... 
[(var pod/x) 12]

but within a bare-bones project or at the REPL not driven by Boot the stanza produces errors:

IllegalArgumentException Provided artifact is missing a version: [boot/pod nil]  cemerick.pomegranate.aether/add-version-from-managed-coord (aether.clj:654)
CompilerException java.lang.RuntimeException: Unable to find static field: config in class boot.App, compiling:(/private/var/folders/hd/gyfcfwyd0b7ftv_0dd6qt17c0000gp/T/form-init7647312233656327720.clj:1:845) 

I’ve gotten this far with the following (Leiningen) dependencies:

 [boot/aether "2.8.1"]
 [boot/base "2.8.1"]
 [boot/core "2.8.1"]
 [boot/pod "2.8.1"]

I’ve tried many variations of the env argument of make-pod, but haven’t found anything that gets me beyond this impasse. Looking forward to being able to make use of Boot’s pods for our forthcoming OSS templating library :slight_smile:


Boot isn’t designed to be used as a library and the startup shim (in boot.App, a Java class) does a fair bit of setup that many parts of Boot required.

You’ll be better off implementing the functionality you want as a standalone library, with boot.pod as a guide.

1 Like

Thanks Sean – I’ll give your suggestion a swing.

It’s really tricky to do a standalone library in clojure itself.

I’d suggest repackaging boot.

Thank you all for your suggestions. After some efforts, I managed to distill the essence of using ShimDandy without Boot.

The end result is Ash Ra Template, a simplistic templating lib reminiscent of Ruby’s ERB but for Clojure instead. In its implementaiton, embed.clj demonstrates a near minimal method of evaluating arbitrary Clojure forms within an embedded Clojure runtime.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.