如何通过逆时针(或la clojure)运行/调试compojure web应用程序 [英] How to run/debug compojure web app via counterclockwise (or la clojure)

查看:219
本文介绍了如何通过逆时针(或la clojure)运行/调试compojure web应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在compojure写我的第一个网络应用程序。我使用ccw和 File-New-Project,Clojure Project 并使用compojureleiningen模板。最终以像

I'm trying to write my first web app in compojure. I'm using ccw, and I File-New-Project, Clojure Project and use the "compojure" leiningen template. End up with project.clj looking like

(defproject asdf "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :dependencies [[org.clojure/clojure "1.4.0"]
                 [compojure "1.1.5"]]
  :plugins [[lein-ring "0.8.2"]]
  :ring {:handler asdf.handler/app}
  :profiles
  {:dev {:dependencies [[ring-mock "0.1.3"]]}})

src / asdf / handler.clj看起来像

src/asdf/handler.clj looks like

(ns asdf.handler
  (:use compojure.core)
  (:require [compojure.handler :as handler]
            [compojure.route :as route]))

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

(def app
  (handler/site app-routes))

我发现我可以从命令行使用 lein环服务器但我不知道如何从eclipse运行这个。我当然希望能够不仅运行它,而且还要调试它和设置断点等。有没有办法在eclipse这样做?或者,如果不是,IntelliJ / La-Clojure怎么样? (我有点害怕emacs,现在,但也许如果它是超简单我会试试)。

I found I can run this using lein ring server from the command line, but I'm not sure how to run this from eclipse. I'm of course hoping to be able not only to run it, but also to debug it and set breakpoints and such. Is there a way to do this in eclipse? Or, if not, how about IntelliJ/La-Clojure? (I'm a bit afraid of emacs, for now, but maybe if it's super-simple I'd give it a try).

或者,这只是不是compojure应用程序的典型开发过程? (如果没有,是什么?只需运行 lein环服务器并祈祷?)

Or, is this just not the typical development process for a compojure app? (If not, what is? Just run lein ring server and pray?)

推荐答案

下面是一个在开发Ring应用程序时非常适合我的配方:

Here's a recipe that's work great for me while developing Ring applications:


  • 确保您为projet正确配置了leiningen支持(如果有疑问,请执行一次):

    • 浏览器,选择项目,并调用上下文命令 Leiningen>重置配置

    • 然后还调用 Leiningen>更新依赖项命令

    • 您应该会在项目中看到一个 Leiningen Dependencies 虚拟节点,您的项目的传递依赖性

    • Ensure you have leiningen support properly configured for your projet (do it once if in doubt):
      • in the package explorer, select the project, and invoke the contextual command Leiningen > Reset configuration
      • then also invoke the Leiningen > Update dependencies command
      • you should see a Leiningen Dependencies virtual node in your project, referencing the direct and transitive dependencies of your project


        您现在可以在编辑者和REPL之间导航。

      You can now navigate between the editors and the REPL.

      • To send editor content to the REPL, select it, and hit Ctrl+Enter
      • If you hit Ctrl+Enter without a selection, the whole 'top level expression' (e.g. a defn) will be sent to the REPL
      • To resend the whole file to the REPL, type Ctrl+Alt+S
      • the whole list of keyboard shortcuts specific to CCW is here: http://code.google.com/p/counterclockwise/wiki/EditorKeyBindingsFeatures

      请注意,未来版本的逆时针将会与Leiningen 2更多一点,但是目前的情况是,开发 ring 应用程序使它不那么痛苦,如上所述的IMHO

      Note that a future version of Counterclockwise will integrate a little bit more with Leiningen 2, but as it currently stands, the very nature of developing ring applications make it not so painful to bootstrap things as described above, IMHO

      这篇关于如何通过逆时针(或la clojure)运行/调试compojure web应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆