Found the problem: When I have a :main configuration entry in my project.clj, I get the error messages. Here's what my project.clj looks like: (defproject cljsconsole "1.0.0-SNAPSHOT" :description "Web Console for ClojureScript compilation" :repositories {"clojure-releases" "http://build.clojure.org/releases"} :dependencies [[org.clojure/clojure "1.3.0-beta2"] [org.clojure/clojure-contrib "1.2.0"] [cljs-compiler-jar "0.1.0-SNAPSHOT"] [goog-jar "1.0.0"] [compojure "0.6.4"] [enlive "1.0.0-SNAPSHOT"]] :dev-dependencies [[lein-ring "0.4.5"]] :ring {:handler cljsconsole.core/app} :main cljsconsole.core/dev)
When I remove it, launch the REPL using "lein repl", and then use to the REPL to launch Compojure/Ring, everything works fine: ringo:clojurescript-webconsole raju$ lein repl REPL started; server listening on localhost port 23826 user=> (use 'cljsconsole.core) nil user=> (dev) 2011-08-31 03:05:33.553:INFO::Logging to STDERR via org.mortbay.log.StdErrLog 2011-08-31 03:05:33.554:INFO::jetty-6.1.26 2011-08-31 03:05:33.571:INFO::Started SocketConnector@0.0.0.0:8080 #<Server Server@61556234> user=> Aug 31, 2011 3:05:36 AM clojure.contrib.logging$eval1129$impl_write_BANG___1132 invoke INFO: Building app for URI /test.cljs Aug 31, 2011 3:05:36 AM clojure.contrib.logging$eval1129$impl_write_BANG___1132 invoke INFO: Processing ClojureScript file: resources/public/test.cljs Aug 31, 2011 3:05:36 AM clojure.contrib.logging$eval1129$impl_write_BANG___1132 invoke INFO: Target folder: resources/public/_build Aug 31, 2011 3:05:36 AM clojure.contrib.logging$eval1129$impl_write_BANG___1132 invoke INFO: Target file: test1314752736109.js Aug 31, 2011 3:05:36 AM clojure.contrib.logging$eval1129$impl_write_BANG___1132 invoke INFO: Using opts: {:output-dir "resources/public/_build", :output-to "resources/public/_build/test1314752736109.js", :output-one-file :true, :optimizations :simple} I'm glad that it's working for me, but I don't understand what's exactly going on if :main is set. - Raju On Wed, Aug 31, 2011 at 2:35 AM, Raju Bitter <rajubit...@googlemail.com> wrote: > I've experienced the same problem (long list of undeclared vars) on OS > X (10.6.8), with JDK version 1.6.0.26 and 1.6.0.22, when I tried to > call the cljs.closure/build function out of a Ring/Compojure web > application. > > Then I tested on Ubuntu 11.04 in VirtualBox, just trying to compile a > *.cljs file out of the REPL, everything worked for me. > > Java version on Ubuntu: > java version "1.6.0_26" > Java(TM) SE Runtime Environment (build 1.6.0_26-b03) > Java HotSpot(TM) Client VM (build 20.1-b02, mixed mode, sharing) > > Here are the steps I followed: > 1) Create a new project: >> lein new cljstest > > 2) Added dependencies to project.clj > (defproject cljstest "1.0.0-SNAPSHOT" > :description "FIXME: write description" > :dependencies [[org.clojure/clojure "1.3.0-beta2"] > [cljs-compiler-jar "0.1.0-SNAPSHOT"] > [goog-jar "1.0.0"]]) > > 3) Resolve dependencies: "lein deps" > > 4) Created a simple ClojureScript test file in src/test.cljs > (defn hello-world [msg] > (println msg)) > > (hello "world") > > 5) Repl launched: "lein repl" > > 6) In the REPL, did > user=> (use 'cljs.closure) > nil > user=> (build "src/test.cljs" {:output-dir "./", :output-to > "./test-compiled.js", :optimizations :simple}) > nil > user=> > > It seems the problem is not connected to the Java/JDK version in my > case, since downgrading to 1.6.0.22 didn't solve the problem. > > I'll do some more testing and keep you updated on my results. > > Raju > > > On Wed, Aug 17, 2011 at 10:05 PM, kjeldahl > <mariusauto-googlegro...@kjeldahl.net> wrote: >> I have another data point to add to my testing regarding this problem. >> Defining a pretty minimal little clojure test program: >> >> (ns cljstest.main >> (:require [cljs.closure :as closure])) >> >> (defn -main [& m] >> (closure/build "src/mycljs/hello.cljs" {:optimizations :simple >> :output-dir "out/" >> :output-to "out/ >> bootstrap.js"}) >> (println "Hello world.")) >> >> Running this with "lein run" fails as I've described earlier in this >> thread. For the hell of it, I removed all the compiled code in the >> "classes" dir, and simply started a java repl in the same dir, with >> the same classpath leiningen would use EXCEPT I removed the "classes" >> part, and then inside the repl run: >> >> (use 'cljstest.main) >> (-main) >> >> Then everything works just fine. It definitively looks like something >> is wonky in the clojurescript compiler that requires it to run in some >> kind of repl environment (or depends on some kind of sideeffect of the >> repl environment). >> >> Thanks, >> >> Marius K. >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clojure@googlegroups.com >> Note that posts from new members are moderated - please be patient with your >> first post. >> To unsubscribe from this group, send email to >> clojure+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/clojure?hl=en > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en