I have a project with following ns:
- processor.bus <- general protocol for bus operations
- processor.core <- main class to run
- processor.pubsub <- concrete bus methods
in processor.pubsub I have following:
(ns processor.pubsub
(:gen-class))
(defrecord PubsubBus [client])
; + other stuff related to this implementation
In processor.bus I have:
(ns tiptop.processor.bus
(:gen-class)
(:import [processor.pubsub PubsubBus]))
(defprotocol SendToBus
(send-line! [self json]))
(extend-type PubsubBus
SendToBus
....)
The problem that Lein doesn't compile namespaces in right order. I get following error:
$ lein compile
Compiling user
Compiling processor.auth
Compiling processor.bus
java.lang.ClassNotFoundException: processor.pubsub.PubsubBus, compiling:(bus.clj:1:1)
Exception in thread "main" java.lang.ClassNotFoundException: processor.pubsub.PubsubBus, compiling:(bus.clj:1:1)
Notice it tries to compile my ns in alphabetical order (auth -> bus -> pubsub), instead if dependency order.
Of course I could precompile pubsub.clj before, like:
$ lein compile processor.pubsub
$ lein compile processor.bus
$ lein compile
But it doesn't seems quite right for me. What if I'll have more such dependent namespaces?
How I can tell Lein in which order it should compile my namespaces? Or maybe i'm missing something to configure in project.clj? I have :aot :all if it matters