Small and furry, well ... definitely furry. [source]

Thursday, March 17, 2011

Static resources in Compojure "uberjar"

I've wrote a little web server to show some graphs at work, and wanted to distribute it as an "uberjar". James Reeves was kind enough to supply an answer.

What you need to do:
  • Place your files under resources/public
  • Add (route/resource "/") to your handler map
    •  And (require '[compojure.route :as route]) somewhere before
  • Add :resources-path "resources" to project.clj
After that you can access your resources both when developing and from the jar.

See an example here.

1 comment: