我如何让clojurescript和lein-cljsbuild使用最新版本的google关闭而不是去年的版本?我想使用诸如websockets抽象层之类的新功能。
我尝试制作一个最新版本的jar并使用lein-localrepo进行安装,但它似乎没有任何影响。
有什么建议吗?
答案 0 :(得分:1)
您可以使用不同版本的Google Closure编译器,只需在project.clj中排除Clojurescript的依赖关系并添加其他版本即可。以下是使用最新版本的Clojurscript和Google Closure编译器的the example project that comes with lein cljs-build的替代版本。
(defproject cljsbuild-example-simple "0.3.4"
:description "A simple example of how to use lein-cljsbuild"
:source-paths ["src-clj"]
:dependencies [[org.clojure/clojure "1.5.1"]
[com.google.javascript/closure-compiler "v20131014"]
[org.clojure/clojurescript "0.0-1934"
:exclusions [org.apache.ant/ant
com.google.javascript/closure-compiler]]
[compojure "1.0.4"]
[hiccup "1.0.0"]]
:plugins [[lein-cljsbuild "0.3.4"]
[lein-ring "0.7.0"]]
:cljsbuild {
:builds [{:source-paths ["src-cljs"]
:compiler {:output-to "resources/public/js/main.js"
:optimizations :whitespace
:pretty-print true}}]}
:ring {:handler example.routes/app})
这导致了这个依赖树:
[clojure-complete "0.2.3" :exclusions [[org.clojure/clojure]]]
[com.google.javascript/closure-compiler "v20131014"]
[args4j "2.0.16"]
[com.google.code.findbugs/jsr305 "1.3.9"]
[com.google.guava/guava "15.0"]
[com.google.protobuf/protobuf-java "2.4.1"]
[org.json/json "20090211"]
[compojure "1.0.4"]
[clout "1.0.1"]
[org.clojure/core.incubator "0.1.0"]
[org.clojure/tools.macro "0.1.0"]
[ring/ring-core "1.1.0"]
[clj-time "0.3.7"]
[joda-time "2.0"]
[commons-codec "1.6"]
[commons-fileupload "1.2.1"]
[commons-io "2.1"]
[javax.servlet/servlet-api "2.5"]
[hiccup "1.0.0"]
[org.clojure/clojure "1.5.1"]
[org.clojure/clojurescript "0.0-1934" :exclusions [[org.apache.ant/ant] [com.google.javascript/closure-compiler]]]
[org.clojure/data.json "0.2.3"]
[org.clojure/google-closure-library "0.0-20130212-95c19e7f0f5f"]
[org.clojure/google-closure-library-third-party "0.0-20130212-95c19e7f0f5f"]
[org.clojure/tools.reader "0.7.9"]
[org.mozilla/rhino "1.7R4"]
[org.clojure/tools.nrepl "0.2.3" :exclusions [[org.clojure/clojure]]]
然后编译它:
$ lein cljsbuild once
Compiling ClojureScript.
Compiling "resources/public/js/main.js" from ["src-cljs"]...
Successfully compiled "resources/public/js/main.js" in 9.181874 seconds.
希望这有帮助!