我有一个clj / cljs应用程序,并且正在使用boot作为构建工具。
我有一个dev
任务,可以立即给我反馈开发环境,并且效果很好!
但是,我在尝试建立一个生成.jar
并可以部署到生产环境的构建任务时遇到了麻烦。
问题是:
生产版本仍尝试连接到weasel
。在浏览器控制台中看到:
websocket.js:283 WebSocket connection to 'ws://localhost:35243/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
:advanced
)有人可以指出我做错了什么吗?
我的dev
任务如下:
(deftask add-cljs-dev-deps []
(merge-env! :dependencies
'[[cider/piggieback "0.4.1" :scope "test"]
[nrepl "0.6.0" :scope "test"]
;; [com.cemerick/piggieback "0.2.2" :scope "test"]
[weasel "0.7.0" :scope "test"]
[org.clojure/tools.nrepl "0.2.13" :scope "test"]])
identity)
(deftask dev
"Launch Immediate Feedback Development Environment"
[]
(require '[adzerk.boot-reload]
'[pandeiro.boot-http]
'[adzerk.boot-cljs-repl])
(let [reload (resolve 'adzerk.boot-reload/reload)
serve (resolve 'pandeiro.boot-http/serve)
cljs-repl (resolve 'adzerk.boot-cljs-repl/cljs-repl)
start-repl (resolve 'adzerk.boot-cljs-repl/start-repl)]
(comp
(add-cljs-dev-deps)
(serve :handler 'myapp.core/app ;; ring handler
:resource-root "public" ;; root classpath
:port 3500
:reload true) ;; reload ns
(watch)
(reload)
(cljs-repl) ;; before cljs task
(cljs :source-map true :optimizations :none)
(sass)
(target :dir #{"public"}))))
和我的build
生产任务如下:
(deftask build
"Builds an uberjar of this project that can be run with java -jar"
[]
(comp
(aot :all true)
(pom)
(cljs :optimizations :advanced
:compiler-options {:optimizations :advanced})
(sass)
(sift :move {#"(.*)js$" "public/$1js"
#"(.*)html$" "public/$1html"
#"css/(.*)" "public/css/$1"})
(uber :exclude-scope #{"test"})
(jar :file "myapp.jar" :main 'myapp.server )
(sift :include #{#"myapp.jar"})
(target)))
完整的build.boot
可以在here中找到。