首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >不能用Leiningen 2.5.2运行uberjar

不能用Leiningen 2.5.2运行uberjar
EN

Stack Overflow用户
提问于 2015-09-13 21:22:23
回答 1查看 1.4K关注 0票数 2

我本来想再去接克洛尔的,但一开始我就绊倒了。我下载了lein,并复制了下面的project.cljhello.clj,以确保我有一个最小的工作示例。

project.clj:

代码语言:javascript
复制
(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:

代码语言:javascript
复制
(ns hello.core
  (:gen-class)
  )
(defn -main
  "This should be pretty simple."
  []
  (println "Hello, World!"))

当我运行'./lein uberjar‘时,我会收到以下警告:

代码语言:javascript
复制
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 runjava -jar ./target/hello-0.1.0-SNAPSHOT-standalone.jar中运行此操作会导致异常:

代码语言:javascript
复制
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)

我在这里有什么问题?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-09-13 21:50:16

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

并将hello.clj移到./src/hello目录,并将其重命名为core.clj。

票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32554675

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档