【发布时间】:2015-11-29 06:52:33
【问题描述】:
如何生成一个独立的环uberjar 来监听给定的端口?
在开发时,我使用以下 leiningen/ring 命令启动我的应用程序,我可以在其中指定端口:
lein with-profile dev ring server-headless 9696
现在我想部署它,所以我跑了:
lein with-profile prod ring uberjar 9696
但我得到了一个错误:
Error encountered performing task 'ring' with profile(s): 'prod'
clojure.lang.ArityException: Wrong number of args (2) passed to: uberjar/uberjar
所以我在我的project.clj 中添加了一个:port:
:ring {:handler img-cli.handler/handler
:init img-cli.handler/init
:destroy img-cli.handler/destroy
:port 9696}
lein with-profile prod ring uberjar
java -jar my-jar.jar
但后来我在日志中看到:Started server on port 3000
如何使用我想要的端口生成uberjar?
注意:以防万一,我使用的是compojure。
【问题讨论】:
-
它对我有用,你是否在应用 project.clj 中的更改后编译了 jar?
-
@PauloBu 啊原来我不得不使用
lein with-profile +prod ring uberjar 9696(注意+)
标签: clojure leiningen compojure ring