English 中文(简体)
Clojure / Lein / Pack into Jar
原标题:Clojure / Lein / Package into Jar

在过去6个月里,我一直在接手我的衣着。

I.e., whenever I want to run the app, I load up a clojure repl, then I type in: (load-file "src/run.clj") ... and it runs my app.

之后,我的所有文件都装上了衣物,汇编了这些档案,并投入使用。

I have recently switched over to Lein. I would like to "compile ahead of time / package up" my code, so that I can get a single jar, with Main method, and run it directly on the command line via "java ..." rather than having to load up a clojure/lein repl.

我清楚地看到,我需要做一些调试。 然而,如果有人可以向我说好的教导的话,那将非常感激。

感谢!

问题回答

https://codeberg.org/leiningen/leiningen/src/branch/stable/doc/TUTORIAL.md” rel=“nofollow noreferer” 。 在我们结束今后任何死亡联系的情况下,我只列入这一信息。

  1. You first need to designate the main namespace by adding :main to project.clj

    (defproject yourproject "0.1" :dependencies [[org.clojure/clojure "1.4.0"]] :main yourproject.core)

  2. 在你指定的主要名称空间,你必须添加<条码>(:gen-class),并且你必须使用<条码>(defn -main......)指定主要职能。

    (ns yourproject.core (:gen-class))

    (defn -main [& args] (println "This is your crazy project!"))

  3. run uberjar to create the standalone jar

    lein uberjar

  4. 页: 1

    java -jar yourproject.jar





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签