如何生成独立的环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中添加了一个project.clj:
: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。
发布于 2015-09-03 16:04:24
事实证明,我对配置文件的使用是有问题的。
仔细观察一下概况文件的收益率:
若要激活除默认值之外的配置文件,请在配置文件前面加上+:
$ lein with-profile +server run
因此,我不得不使用lein with-profile +prod ring uberjar 9696 (注意+)。
https://stackoverflow.com/questions/32375597
复制相似问题