首页 > 其他 > 详细

Run Clojure Script with External Dependencies without leiningen

时间:2014-03-20 02:26:43      阅读:391      评论:0      收藏:0      [点我收藏+]

The normal way of deploy clojure files is using leiningen. But if we have no leiningen, or the script is small and unnecessary to pack as a leiningen project, we can build a "bare" clojure script in the following way.

  1. Get the dependency jar files, 2 options:

    i. download the jar file directly;

    i. if the dependency project provide the dependency as leiningen dependency items in porject.clj (for example, "[org.clojure/data.json "0.2.3"]" in data.json), you can build the leiningen project following Parse Sonarqube Data via Web API in Clojure , then copy the denpendency jar files from the ~/.m2/repository folder;

  2. Build srcipt: get-sonar-data.clj

    (require ‘[clojure.data.json :as json])

    (def url "http://10.0.2.74:9000/api/resources?resource=ESB:com.boco.esb.analysismgr.service.impl&metrics=classes")

    (def data (json/read-str (slurp url)))

    (println ((first data) "name"))

    (println ((first ((first data) "msr")) "val"))

  3. Run script: java -cp ‘./*:.‘ clojure.main get-sonar-data.clj

Run Clojure Script with External Dependencies without leiningen,布布扣,bubuko.com

Run Clojure Script with External Dependencies without leiningen

原文:http://www.cnblogs.com/darkmatter/p/3612454.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!