Can't run uberjar with Leiningen 2.5.2

I was trying to pick up Clojure again, but am stumbling right at the beginning. I downloaded lein, and copied the following project.clj and a hello.clj to be absolutely sure that I have a minimal working example.

project.clj:

(defproject hello "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.7.0"]]
  :uberjar {:aot :all}
  :main hello.core
  )

hello.clj:

(ns hello.core
  (:gen-class)
  )
(defn -main
  "This should be pretty simple."
  []
  (println "Hello, World!"))

When I run './lein uberjar' I get these warnings:

Warning: specified :main without including it in :aot. 
Implicit AOT of :main will be removed in Leiningen 3.0.0. 
If you only need AOT for your uberjar, consider adding :aot :all into your
:uberjar profile instead.
Warning: The Main-Class specified does not exist within the jar. It may not be executable as expected. A gen-class directive may be missing in the namespace which contains the main method.
Created .../target/hello-0.1.0-SNAPSHOT.jar
Created .../target/hello-0.1.0-SNAPSHOT-standalone.jar

Trying to run this either with ./lein run or with java -jar ./target/hello-0.1.0-SNAPSHOT-standalone.jar results in exceptions:

Can't find 'hello.core' as .class or .clj for lein run: please check the spelling.
Exception in thread "main" java.io.FileNotFoundException: Could not locate hello/core__init.class or hello/core.clj on classpath., compiling:(/private/var/folders/28/bk6d4xj123b0xvsvk91_1jg80009rn/T/form-init1007755193774766954.clj:1:125)

So what is my problem here?


:uberjar {:aot :all} -> :profiles {:uberjar {:aot :all}}

And move hello.clj into ./src/hello directory and rename it to core.clj

链接地址: http://www.djcxy.com/p/51744.html

上一篇: 在Leiningen创建uberjar时运行另一项任务

下一篇: 无法与Leiningen 2.5.2一起运行uberjar