boot-immutant sample?

25 views
Skip to first unread message

James Gatannah

unread,
Nov 4, 2017, 8:32:32 AM11/4/17
to Immutant
I'm trying to convert a project (for running inside wildfly) over from leiningen (since the build pieces got too messy), and I think I'm missing something really basic.

I have a basic

(deftask build-immutant-dev-war
  []
  (comp
    (gird :dev true :init-fn foo/init)
    (war)
    (target)))

that I just copy/pasted from the wiki.

When I actually run the gird part (either from the command line or directly from inside the boot REPL), it fails with a FileNotFoundException about many/most 3rd party libraries that I try to :require.

I thought there might be a problem because I have a dev/ folder for the Stuart Sierra Component idea that I really don't want to include outside of test, so I went through there and commented out enough to get into my actual implementation code. But then it started failing on libraries that I'm really using.

I don't see any rhyme or reason to it.

It fails on cheshire, core.async, and clojure.tools.namespace.repl. It's fine with libraries like integrant and pedestal (well, some of them. io.pedestal.http seems fine; io.pedestal.http.body-params is not). Those are all top-level direct dependencies set up in build.boot. I have some exclusions set up in other library dependencies that rely on them due to version conflicts.

At this point, I can't swear that the leiningen version works either. I started this port a few months back, and keep getting distracted.

Does this make any sense at all (or ring any bells) to anyone else? Is there a stripped-down example somewhere that I could use as a starting point to build it back up from the ground floor?

Thanks,
James

Toby Crawley

unread,
Nov 4, 2017, 8:40:23 AM11/4/17
to James Gatannah, Immutant
Hi James:

The problem may be that you're passing foo/init without quoting it, so
boot is loading the foo ns at build-time. Try (gird :dev true :init-fn
'foo.init) and see if that works.

- Toby
> --
> You received this message because you are subscribed to the Google Groups
> "Immutant" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to immutant+u...@googlegroups.com.
> To post to this group, send email to immu...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/immutant/7d361eeb-d777-4e5e-92d6-a65923352666%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

James Gatannah

unread,
Nov 5, 2017, 8:41:31 AM11/5/17
to Toby Crawley, immu...@googlegroups.com
Here's one piece of the puzzle:

I can reproduce the basic problem by adding a dev/ folder to boot's
:source-paths environment and adding a :require entry to a 3rd-party
library that I don't reference from the namespace that contains the
main function.

You can see this in action at
https://github.com/jimrthy/ideal-rotary-phone/tree/immutant/uberwar by
trying to run `(boot (build-immutant-dev-war))` from the boot repl.

That seems like a "Well, don't do that" issue that might be worth
writing up somewhere.

On the other hand, I have other issues that don't seem quite that easy.

In the real project where I started, I have another source path that
contains my .cljc files (and another for the .cljs). I've seen the
same problems from there, referencing libraries that the main ns also
uses (transitively).

For that scenario, my folder structure looks like this:

dev/user.clj
src/clj/foo/main.clj
/routes.clj
/system.clj
src/cljc/foo/lamport.cljc

The init-fn function is in main.clj. It requires foo.system, which
requires both integrant.core and foo.lamport.

foo.lamport also requires integrant.core.

Now that I've cleaned up the other problems, I've started getting an
error when gird tries to compile foo.lamport, because it can't find
integrant.core. So far, I haven't had any luck reproducing this one on
a smaller scale.

This one's messier, because I'm using foo.lamport everywhere (except from user).

user and system both reference foo.routes, which references cheshire.

If I comment out the references to it in user, the only problem I see
comes from lamport. When I leave it in place, I get an error from gird
about it (foo.routes) that cheshire isn't on the CLASSPATH.

I'll keep working on a minimal repro example.


On Sat, Nov 4, 2017 at 1:25 PM, James Gatannah <james.g...@gmail.com> wrote:
> Copy/paste failure on my part.
>
> If I unquote the init-fn symbol (like in that example), I get a
> ClassNotFound exception about it.
>
> The problems I'm seeing come from the ns forms. I'll start over with a
> minimalist example to see if I can figure it out from that angle.
>
> I was mostly just being lazy and hoping someone else had already run
> across (and solved) the same problem.
>
> Thanks,
> James
Reply all
Reply to author
Forward
0 new messages