与Leiningen一起部署Clojure应用程序

时间:2011-12-25 07:56:45

标签: java clojure leiningen

到目前为止,这是我的project.clj文件:

(defproject raj "0.0.1-SNAPSHOT"
  :description "FIXME: write description"
  :dependencies [[org.clojure/clojure "1.3.0"]]
  :keep-non-project-classes true
  :main raj.core)

我的core.clj文件:

(ns raj.core
  (:use raj.core))

(defn -main [& args]
  (println "Hello World!!!"))

lein run -m raj.core显示Hello World消息就好了。接下来我尝试lein uberjar并获取

Compiling raj.core
Compilation succeeded.
Created C:\Users\bobjones\IdeaProjects\raj/raj-0.0.1-SNAPSHOT.jar
Including raj-0.0.1-SNAPSHOT.jar
Including clojure-1.3.0.jar
Created C:\Users\bobjones\IdeaProjects\raj/raj-0.0.1-SNAPSHOT-standalone.jar

到目前为止,一切似乎都很顺利,所以我尝试java -jar raj-0.0.1-SNAPSHOT-standalone.jar,然后收到

Error: Could not find or load main class raj.core

我在这会做错什么?

1 个答案:

答案 0 :(得分:28)

您需要向:gen-class命名空间添加raj.core声明:

(ns raj.core
  (:use raj.core)
  (:gen-class))