从Intellij IDEA REPL运行带有铃音的compojure

时间:2019-04-05 07:49:41

标签: intellij-idea clojure leiningen

我一直在努力从IntelliJ Idea启动基于compojure的应用程序,我遵循了这个stackoverflow答案中提供的说明

How to use compojure from Intellij

但是,当我尝试加载处理程序时,我会得到*ClassNotFoundException*

(use hello-compojure.handler)
Syntax error (ClassNotFoundException) compiling at (form-init4214569335684752102.clj:1:1).
hello_compojure.handler

下面是处理程序代码

(ns hello-compojure.handler
  (:require [compojure.core :refer :all]
            [compojure.route :as route]
            [ring.middleware.defaults :refer [wrap-defaults site-defaults]]))

(defroutes app-routes
  (GET "/" [] "Hello World")
  (GET "/hello" []  "hello second world")
  (route/not-found "Not Found"))

(def app
  (wrap-defaults app-routes site-defaults))

任何有这种设置经验的人吗?

1 个答案:

答案 0 :(得分:0)

原来我在'声明中错过了require

Connecting to local nREPL server...
Clojure 1.10.0
nREPL server started on port 33629 on host 127.0.0.1 - nrepl://127.0.0.1:33629
(require 'ring.adapter.jetty)
=> nil
(require 'hecompojure.handler)
=> nil
(ring.adapter.jetty/run-jetty hecompojure.handler/app {:port 3004})
2019-04-05 14:05:34.766:INFO:oejs.Server:jetty-7.6.13.v20130916
2019-04-05 14:05:34.800:INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:3004