CircleCI-Archived / stefon

An asset pipeline for clojure
98 stars 16 forks source link

Null Pointer Exception when aot compiling #6

Closed cbui closed 11 years ago

cbui commented 11 years ago

I'm trying to compile an uberjar for my web application and I'm getting this error:

lein compile Compiling stefon-compile.core WARNING: name already refers to: #'clojure.core/name in namespace: stefon.asset, being replaced by: #'stefon.asset/name Exception in thread "main" java.lang.NullPointerException, compiling:(core.clj:1:1)

Here's a repo that reproduces it:

https://github.com/Christopher-Bui/stefon-compile

Steps to reproduce:

  1. Create a new project.
  2. Add [circleci/stefon "0.5.0-SNAPSHOT"] to dependencies.
  3. Add :aot :all to project.clj
  4. Add (:require [stefon.core :as stefon]) in a namespace.
  5. lein compile

Supposedly the problem is due to the the conflicting names as an answer on SO says: http://stackoverflow.com/a/11534475/90537.

But I've looked in stefon.asset and practically everywhere and I can't find anything that defines name.

cbui commented 11 years ago

After the previous fix, I'm now getting this:

Exception in thread "main" java.lang.RuntimeException: No such var: file/file-request, compiling:(stefon/middleware/expires.clj:38:23).

file is ring.middleware.file, which, looking at the docs doesn't even have a file-request function.

http://clojuredocs.org/ring/ring.middleware.file/wrap-file

Any ideas?

pbiggar commented 11 years ago

I don't see file-request used anywhere...

cbui commented 11 years ago

https://github.com/circleci/stefon/blob/master/stefon-core/src/stefon/middleware/expires.clj#L38

pbiggar commented 11 years ago

Ah. I have that replaced locally with

(if-let [resp ((file/wrap-file (constantly nil) root-path) req)]

Not sure why I haven't got that committed, I'll look into it. Feel free to make a PR with the change.

pbiggar commented 11 years ago

Never mind, I pushed it.