Deploying Clojure apps with Leiningen

会有一股神秘感。 提交于 2019-12-03 08:53:50

问题


This is my project.clj file so far:

(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)

And my core.clj file:

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

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

lein run -m raj.core displays the Hello World message just fine. So next I try lein uberjar and get

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

Everything seems to be going well so far, so I try java -jar raj-0.0.1-SNAPSHOT-standalone.jar, and I receive

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

What would I be doing wrong here?


回答1:


You need to add a :gen-class declaration to the raj.core namespace:

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


来源:https://stackoverflow.com/questions/8628753/deploying-clojure-apps-with-leiningen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!