Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/clojure/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
需要为已编译的clojure类创建jar文件_Clojure - Fatal编程技术网

需要为已编译的clojure类创建jar文件

需要为已编译的clojure类创建jar文件,clojure,Clojure,我正在学习clojure,已经得到了一份作业 我需要自动编译和构建生成的类的jar 在clojure代码中,我需要编译另一个clojure代码,编写代码来构建生成的类的jar 这是我的例子 偶数测试.clj (ns clojure.sqe.examples) (defn pair-test [test-fn n1 n2] (if (test-fn n1 n2) "sucess" "failed")) (println (pair-test #(even? (+ %1 %2)) 3 4)) ;

我正在学习clojure,已经得到了一份作业

我需要自动编译和构建生成的类的jar

在clojure代码中,我需要编译另一个clojure代码,编写代码来构建生成的类的jar

这是我的例子

偶数测试.clj

(ns clojure.sqe.examples)

(defn pair-test [test-fn n1 n2]
(if (test-fn n1 n2) "sucess" "failed"))

(println (pair-test #(even? (+ %1 %2)) 3 4)) ; -> pass
编译_test.clj

(ns clojure.sqe.examples
    (:use clojure.test)
    (:require [simple-check.core       :as sc])
)

(compile 'clojure.sqe.examples.even_test)
;(println *compile-path*) => classes

;TO-DO - Write code to
;Build the jar for the compiled classes or from classes folder

; upload this jar to a service . 
你为什么不使用?这是进行Clojure开发的事实。您可以做很多事情,比如编译Clojure源代码、编译Java源代码、运行单元测试、从porject.clj生成POM文件,当然还有生成JAR文件

莱因罐
将项目的所有文件打包成一个jar文件

莱恩·尤贝加尔
将项目文件和所有依赖项打包到一个jar文件中


你需要1。编译代码,然后2。创建一个包含已编译代码的JAR文件

Clojure的函数编译代码,并将编译后的类文件(可以有多个)放在
*compile path*
指定的目录下

您将需要使用(和可选的a)创建一个JAR文件,并将
*compile path*
下的所有文件写入JAR。您必须调整路径,以便像
target/repl/classes/clojure/sqe/examples.class
这样的文件作为
clojure/seq/examples.class
放入JAR中


leinjar
命令或多或少可以做到这一点,因此您可能需要查看其源代码以了解详细信息:

更新了我的帖子。我必须编写一个代码来使用leiningen在clojure代码compile_test.cljDitto中构建jar。它简化了相当多的开发,是一个非常好的工具。