gcv/appengine-magic

default-war-root fails sometimes in IntelliJ

Opened this issue · 2 comments

default-war-root should look for "war" locaton using some other point (maybe, project.clj?) as it may fail sometimes. The reason is the following:

When I do development in REPL in IntelliJ La Clojure REPL, the baseLoader is here:
user=> (-> (clojure.lang.RT/baseLoader)
(.getResource "."))

<URL file:/home/jevgeni/projects/sandbox/lib/>

However, if I build/make the project, the REPL will have another baseLoader:
user=> (-> (clojure.lang.RT/baseLoader)
(.getResource "."))

<URL file:/home/jevgeni/projects/sandbox/out/production/sandbox/>

This all will make static resource unavailable, until you remove the "out" manually.

This issue is definitely IntelliJ's specific, but, I guess, the default-war-root should be more robust or give some feedback on this... Otherwise you can spend few hours searching why static resource is found on one machine and isn't on another :)

gcv commented
  1. Did you solve the problem by passing :war-root to your def-appengine-app form?
  2. Would it help if default-war-root checks for the existence of a "war" directory where expected?

the workaround is to rm -rf out folder in the project, so the repl would start with correct root (that is I didnt use war-root property). The problem was that the repl was starting in a different location than the one, expected by app engine magic. I don't think checking for war folder would help, as sometimes "out" contains war folder... I think you could check for project.clj presence (i guess you already depend on that for gae preparation stuff) in the baseLoader folder.