不能 运行 uberjar 与 Leiningen 2.5.2
Can't run uberjar with Leiningen 2.5.2
我试图重新学习 Clojure,但一开始就跌跌撞撞。我下载了 lein,并复制了以下 project.clj
和一个 hello.clj
以确保我有一个最小的工作示例。
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!"))
当我 运行 './lein uberjar' 时,我收到这些警告:
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
使用 ./lein run
或 java -jar ./target/hello-0.1.0-SNAPSHOT-standalone.jar
尝试 运行 会导致异常:
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)
那么我的问题是什么?
:uberjar {:aot :all} -> :profiles {:uberjar {:aot :all}}
并将hello.clj移动到./src/hello目录并将其重命名为core.clj
我试图重新学习 Clojure,但一开始就跌跌撞撞。我下载了 lein,并复制了以下 project.clj
和一个 hello.clj
以确保我有一个最小的工作示例。
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!"))
当我 运行 './lein uberjar' 时,我收到这些警告:
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
使用 ./lein run
或 java -jar ./target/hello-0.1.0-SNAPSHOT-standalone.jar
尝试 运行 会导致异常:
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)
那么我的问题是什么?
:uberjar {:aot :all} -> :profiles {:uberjar {:aot :all}}
并将hello.clj移动到./src/hello目录并将其重命名为core.clj