I don't think leiningen will ever do this, it might be a cleaner hack if
you move the cljsbuild plugin into the dev profile too.

On Monday, June 9, 2014, Chris Jenkins <[email protected]> wrote:

> Actually, putting Clojurescript and any Clojurescript libraries into :dev
> dependencies doesn't quite work in a trouble-free way because it still
> breaks the Clojurescript compilation step in some circumstances. If I do
> the following:
>
> lein clean
> lein uberjar (or lein ring uberwar)
>
> .. then the following error is seen:
>
> Compiling "resources/public/js/script.js" failed.
> clojure.lang.ExceptionInfo: Could not locate hiccups/core__init.class or
> hiccups/core.clj on classpath:  at line 1  {:tag :cljs/analysis-error,
> :file nil, :line 1, :column 1}
> at clojure.core$ex_info.invoke(core.clj:4327)
>  <snip>
>
> I guess lein cljsbuild is trying to build the .cljs source into .js
> (because lein clean has removed all the generated .js files) but it can't
> see any Clojurescript dependencies because the :dev profile isn't active.
>
> I can run
>
> lein with-profile dev uberjar
>
> ... which allows lein cljsbuild to see the Clojurescript dependencies, but
> then puts Clojurescript and all its dependencies into the resulting uberjar
> (which is what I was trying to avoid).
>
> The best way I've found to work round this is always to run lein cljsbuild
> once before running lein uberjar. That gives me an uberjar that does not
> contain the Clojurescript compiler (nor its dependencies) but it seems like
> a bit of a hack to have to do this. Indeed, as far as I understand it,
> using the :dev profile in the manner that I am doing seems like a bit of a
> hack.
>
> In the long term, a solution might be for Leiningen to differentiate
> between Clojurescript and Clojure dependencies and to treat them
> differently. Does that sound like it might be sensible?
>
>
>
> On 9 June 2014 00:31, Chris Jenkins <[email protected]> wrote:
>
> Thanks Gary. That fixed it once I realised that another library,
> cljs-ajax, was also pulling in clojurescript. After moving clojurescript,
> hiccups and cljs-alax into the :dev dependencies, I can now run the app or
> create an uberjar or uberwar and it doesn't pull in Clojurescript's
> dependencies.
>
>
>
> On 9 June 2014 00:00, Gary Trakhman <[email protected]> wrote:
>
> Well, like I mentioned, you can wrap dev-specific dependencies into a :dev
> profile.
>
> :profiles {:dev {:dependencies {[[org.clojure/clojurescript "Blah"]
>                                  [hiccups "hiccups-version"]}}}
>
> they will get merged in when the dev profile is active, but won't end up
> in artifacts.  You could put your :cljsbuild settings in there too, but
> there's no harm in leaving it top-level.
>
> https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md
>
>
> On Sun, Jun 8, 2014 at 6:52 PM, Chris Jenkins <[email protected]>
> wrote:
>
> If I remove clojurescript from my :dependencies in project.clj, two things
> happen:
>
> 1) When I run lein cljsbuild, it complains and says:
>
> "WARNING: It appears your project does not contain a ClojureScript
> dependency. One will be provided for you by lein-cljsbuild ...<snip>" -
> lein-cljsbuild seems to be saying that I *do* need to specify a dependency
> on Clojurescript. Is this correct?
>
> 2)  My app depends on hiccups 0.3.0, which in turn pulls in clojurescript
> 0.0-2069 This is slightly earlier than the level that I just removed from
> my dependencies... but I still don't really want that dependency to be
> there. Is hiccups doing the wrong thing here?
>
> So I still have the same question really: Whether I'm writing an app or a
> library, how can I depend upon Clojurescript in such a way that I can run
> lein cljsbuild at dev time and generate some .js files, and such that, at
> run time, my server-side Clojure code can then forget that Clojurescript
> even exists (and certainly not depend upon the Clojurescript compiler)?
>
>
>
> On 8 June 2014 23:40, Gary Trakhman <[email protected]> wrote:
>
> Clojurescript libs shouldn't specify a Clojurescript dependency (I think).
>
> You can perhaps separate the clojurescript part of your app into a
> separate project or lein profile.
>
> There are other issues that can come about by mixing and matching JVM +
> CLJS deps, one nasty one I hit is a tools.reader incompatibility. CLJS
> itself is sensitive to tools.reader versions, and it took an hour or so to
> debug.
>
>
> On Sun, Jun 8, 2014 at 5:58 PM, Chris Jenkins <[email protected]>
> wrote:
>
> Hi,
>
> I notice that if my project.clj specifies a dependency on Clojurescript
> (or on a Clojurescript library which in turn pulls in Clojurescript), this
> causes my project to have a dependency on the Google Closure compiler and
> all of its dependencies. If I understand this correctly, it means that
> stuff like Guava and FindBugs is on the classpath of my application at
> runtime and those libraries are
>
>

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to