Closed huahaiy closed 13 years ago
The problem is caused by older versions of Compojure not working with newer versions of lein-ring.
In case you're interested, Java has two ways of references resources. One is via the classpath, and the other is via the ServletContext object. Previous versions of Compojure and lein-ring used the ServletContext object, but this is specific to Java's Servlet implementation. I eventually decided that it would be best to use classpath resources exclusively, so current versions of Compojure and lein-ring use the classpath to look for resources.
Obviously this causes a problem if you use a newer version of lein-ring with an older version of Compojure. I shall update the versions to fix this (and I believe someone has already submitted a pull request to do just that).
Since the version of lein-ring (0.3.2) specified in project.clj does not work with leningen 1.6.0 or above due to a bug with lein-ring, I changed the lein-ring version to the latest 0.4.5 which fixed the bug. However, the uberwar created with lein-ring 0.4.5 does not work for tomcat. The style.css cannot be found. The war created by 0.3.2 (using leningen 1.5.2) works though.
The difference between the wars created by 0.4.5 and that by 0.3.2 is the location of the "public" directory, it is under WEB-INF/classes for 0.4.5 whereas it is under root for 0.3.2.
I think this creates a difficulty situation for users. Basically, the latest versions of lein-ring and leningen do not work together for compojure-example project.
From the amount of discussions on the groups, it seems the placement of resources to work well for both lein-ring and war deployment is problematic. Could you investigate this more, and create a updated version of this compojure-example project that works with lein-ring 0.4.5?