Closed ekroon closed 7 years ago
Hi @ekroon. There used to be an issue with AOT compliation indeed, see https://github.com/aroemers/mount-lite/issues/7. That issue was solved, but maybe it has returned because of new changes. I will investigate this later.
additional information: it seems like that the ::order keyword does not get set on the meta-data when the namespace is AOT compiled. I will investigate this more, and check #7
I created PR #11 which fixes the problem. I think adding ::order on runtime should not create other problems, and tests succeed, but if you need more information / tests please say so. I will look into adding AOT compilation tests to circle ci if necessary.
After more investigation in the out-of-band-provided example code, it seems that the issue was with a circular namespace dependency, somewhat like this:
(ns foo
(:use mount.lite)
(:gen-class))
(defstate foo :start "foo")
(defn -main [& args]
(require 'bar)
(start)
...)
(ns bar
(:require foo)
(:use mount.lite))
(defstate bar :start (println foo/foo))
Removing the circular namespace dependency solved the issue.
We are having some issues with defstate declarations in a namespace containing a -main function (with (:gen-class) statement and aot configured in leiningen). When creating an uberjar this will not start the component.
Workaround for this: create uberjar without aot and run with java -cp uber.jar clojure.main -m your.namespace.to.main