【问题标题】:lein ring server giving Compiler exceptionlein ring 服务器给出编译器异常
【发布时间】:2022-12-24 11:35:39
【问题描述】:

我正在阅读“Living Clojure”(2014 年)一书,它有一个名为cheshire-cat 的项目。我的project.clj 文件如下:

(defproject cheshire-cat "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :min-lein-version "2.0.0"
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [compojure "1.3.1"]
                 [ring/ring-defaults "0.1.2"]
                 [ring/ring-json "0.3.1"]
                 [org.clojure/clojurescript "0.0-2371"]
                 [cljs-http "0.1.18"]
                 [org.clojure/core.async "0.1.346.0-17112a-alpha"]
                 [enfocus "2.1.0"]
                 [javax.xml.bind/jaxb-api "2.3.1"]]
  :plugins [[lein-ring "0.8.13"]
            [lein-cljsbuild "1.0.3"]]
  :ring {:handler cheshire-cat.core.handler/app}
  :profiles
  {:dev {:dependencies [[javax.servlet/servlet-api "2.5"]
                        [ring-mock "0.1.5"]]}}
  :cljsbuild {
    :builds [{
      :source-paths ["src-cljs"]
      :compiler {
        :output-to "resources/public/main.js"
        :optimizations :whitespace
        :pretty-print true}}]})

当我尝试使用$lein ring server命令启动环形服务器时,它给出了编译器异常错误:https://pastebin.com/xJmVrJqa

如何使 ring server 命令无误地工作?

【问题讨论】:

  • 需要明确的是,您正在尝试使用八岁例子与八岁所有依赖项的版本。我并不惊讶它不起作用,但我惊讶它和它一样接近。

标签: clojure leiningen ring


【解决方案1】:

好像你遇到了这个问题:https://github.com/metosin/compojure-api/issues/426

这显然已通过此提交修复:https://github.com/metosin/compojure-api-template/pull/7/files

所以我会尝试更新 project.clj 中的 org.clojure/clojure 版本。如果这不起作用,请尝试其他依赖项。特别是compojurelein-ring。但是在更新任何依赖项之前,请检查其更改日志以查看您是否还必须稍微修改代码以适应更新的版本。

通常,这样的事情不会发生在 Clojure 世界中。但在这种情况下,从提交描述来看,Leiningen 似乎在某些时候破坏了一些向后兼容性。

【讨论】:

    猜你喜欢
    • 2013-07-16
    • 2018-04-22
    • 2013-03-25
    • 1970-01-01
    • 2016-04-13
    • 2015-04-28
    • 2013-09-29
    • 1970-01-01
    • 2015-02-01
    相关资源
    最近更新 更多