om-starter icon indicating copy to clipboard operation
om-starter copied to clipboard

lein cljsbuild once release doesn't work

Open be9 opened this issue 11 years ago • 5 comments

The generated project.clj file doesn't have :output-dir setting for cljs release build, and lein cljsbuild once release fails without it:

~/hacks/omtest∴ lein cljsbuild once release
Compiling ClojureScript.
Compiling "resources/public/js/omtest.js" from ["src/cljs"]...
Compiling "resources/public/js/omtest.js" failed.
Exception in thread "main" java.lang.AssertionError: Assert failed: :output-dir "/Users/be9/hacks/omtest/target/cljsbuild-compiler-1" must specify a directory in :output-to's parent "/Users/be9/hacks/omtest/resources/public/js" if optimization setting applied
(same-or-subdirectory-of? (absolute-parent output-to) output-dir)
    at cljs.closure$check_source_map.invoke(closure.clj:1082)
    at cljs.closure$build.invoke(closure.clj:1121)
    at cljs.closure$build.invoke(closure.clj:1105)
    at cljsbuild.compiler$compile_cljs$fn__3127.invoke(compiler.clj:58)
    at cljsbuild.compiler$compile_cljs.invoke(compiler.clj:57)
    at cljsbuild.compiler$run_compiler.invoke(compiler.clj:159)
    at user$eval3253$iter__3256__3260$fn__3261$fn__3273.invoke(form-init2470189019711858903.clj:1)

However if I add this line:

                                 :output-dir "resources/public/js/outrelease"

I get this:

~/hacks/omtest∴ lein cljsbuild once release
Compiling ClojureScript.
Compiling "resources/public/js/omtest.js" from ["src/cljs"]...
Compiling "resources/public/js/omtest.js" failed.
java.lang.IllegalArgumentException: No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil
    at clojure.core$_cache_protocol_fn.invoke(core_deftype.clj:541)
    at clojure.java.io$fn__8551$G__8546__8558.invoke(io.clj:73)
    at clojure.java.io$reader.doInvoke(io.clj:106)
    at clojure.lang.RestFn.invoke(RestFn.java:410)
    at clojure.lang.AFn.applyToHelper(AFn.java:161)
    at clojure.lang.RestFn.applyTo(RestFn.java:132)
    at clojure.core$apply.invoke(core.clj:619)
    at clojure.core$slurp.doInvoke(core.clj:6278)
    at clojure.lang.RestFn.invoke(RestFn.java:410)
    at cljs.closure$preamble_from_paths$fn__2954.invoke(closure.clj:706)
    at clojure.core$map$fn__4207.invoke(core.clj:2485)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:60)
    at clojure.lang.RT.seq(RT.java:484)
    at clojure.core$seq.invoke(core.clj:133)
    at clojure.core$apply.invoke(core.clj:617)
    at cljs.closure$preamble_from_paths.invoke(closure.clj:706)
    at cljs.closure$make_preamble.invoke(closure.clj:710)
    at cljs.closure$optimize.doInvoke(closure.clj:776)
    at clojure.lang.RestFn.applyTo(RestFn.java:139)
    at clojure.core$apply.invoke(core.clj:619)
    at cljs.closure$build.invoke(closure.clj:1158)
    at cljs.closure$build.invoke(closure.clj:1105)
    at cljsbuild.compiler$compile_cljs$fn__3127.invoke(compiler.clj:58)
    at cljsbuild.compiler$compile_cljs.invoke(compiler.clj:57)
    at cljsbuild.compiler$run_compiler.invoke(compiler.clj:159)
    at user$eval3253$iter__3256__3260$fn__3261$fn__3273.invoke(form-init5611761247938341736.clj:1)
    at user$eval3253$iter__3256__3260$fn__3261.invoke(form-init5611761247938341736.clj:1)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:60)
    at clojure.lang.RT.seq(RT.java:484)
    at clojure.core$seq.invoke(core.clj:133)
    at clojure.core$dorun.invoke(core.clj:2780)
    at clojure.core$doall.invoke(core.clj:2796)
    at user$eval3253.invoke(form-init5611761247938341736.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6619)
    at clojure.lang.Compiler.eval(Compiler.java:6609)
    at clojure.lang.Compiler.load(Compiler.java:7064)
    at clojure.lang.Compiler.loadFile(Compiler.java:7020)
    at clojure.main$load_script.invoke(main.clj:294)
    at clojure.main$init_opt.invoke(main.clj:299)
    at clojure.main$initialize.invoke(main.clj:327)
    at clojure.main$null_opt.invoke(main.clj:362)
    at clojure.main$main.doInvoke(main.clj:440)
    at clojure.lang.RestFn.invoke(RestFn.java:421)
    at clojure.lang.Var.invoke(Var.java:419)
    at clojure.lang.AFn.applyToHelper(AFn.java:163)
    at clojure.lang.Var.applyTo(Var.java:532)
    at clojure.main.main(main.java:37)
Subprocess failed

be9 avatar Jan 21 '14 06:01 be9

I'm quite new to clojure(script), might be something trivial. But the generated template doesn't work "off the shelf" for me.

be9 avatar Jan 21 '14 06:01 be9

I actually had this issue the other day and forgot to apply the patch to this repo. Turns out that it's due to my using old references to react js in the :preamble and :externs of the builds. Just deployed a fix -- see if that does the trick.

jalehman avatar Jan 21 '14 06:01 jalehman

Also, the index.html comes configured for the dev build. You'll need to change it as shown here.

jalehman avatar Jan 21 '14 06:01 jalehman

Hm. That didn't seem to fix it. Will check into it.

jalehman avatar Jan 21 '14 06:01 jalehman

@jalehman thanks! what's the exact change that should be applied to index.html? Is there also a way for index.html to work for production and dev environments?

be9 avatar Jan 21 '14 07:01 be9