What is the cause of Lein cyclic dependency error When do I create uberwar?

Building server puzzles - lein ring server-headless- but when I try to build a war or uberwar, I get the following error and cannot understand why this is happening.

No namespaces to :aot compile listed in project.clj.
Exception in thread "main" java.lang.ExceptionInInitializerError, compiling:(ring/util/servlet.clj:62)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6416)
at clojure.lang.Compiler.analyze(Compiler.java:6216)
...

Caused by: java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at clojure.lang.RT.classForName(RT.java:2013)
at clojure.lang.Compiler$HostExpr.maybeClass(Compiler.java:938)
at clojure.lang.Compiler$HostExpr.access$400(Compiler.java:710)
at clojure.lang.Compiler.macroexpand1(Compiler.java:6342)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:6395)
... 69 more
Caused by: java.lang.Exception: Cyclic load dependency: [ /servlet ]->/ring/util/servlet->[ /servlet ]
at clojure.core$check_cyclic_dependency.invoke(core.clj:5288)
at clojure.core$load.doInvoke(core.clj:5383)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.lang.Var.invoke(Var.java:401)
at servlet.<clinit>(Unknown Source)
... 76 more

My project.clj file:

(defproject myproj "0.1"
:description "the sample"
:dependencies [
    [org.clojure/clojure "1.3.0"]
    [compojure "1.0.4"]
    [hiccup "1.0.0"]
    [clj-json "0.5.0"]
    [ring/ring "1.1.0"]
    [clj-http "0.1.1"]
]   
:plugins [
    [lein-ring "0.7.0"]
]   
:ring {:handler routes/start})

If I remove :ring {:handler routes/start}, I get NPE somewhere else.

I do not know if there is anything in my project project.clj, or if a specific version of the lane is violated for this use case. Can anyone clarify this for me?

+3
source share
3 answers

I solved a problem that was a bit of a mistake on my part. Send an answer here if someone makes the same mistake.

In src / routes.clj, I had something like the following:

(defroutes main-routes
    (GET "/some/path" [& params] (some-code params))
    (route/resources "/")
    (route/not-found "not found"))

(def start (run-jetty (handler/site main-routes) {:port 8080}))

webapp lein ring-headless. , , . , - , , uberwar, - , uberwar .

compojure, , , def defn . , :

(defn start [] (run-jetty (handler/site main-routes) {:port 8080}))  
+2

, ,

lein ring uberwar

, , - / servlet.clj target/classes. .

+2

The error says this: the aot parameter is missing in the project configuration. Check out this link for use: aot.

0
source

All Articles