help: compojure/noir version clash? (e.g., OPTIONS routes)

48 views
Skip to first unread message

chisquare05

unread,
Nov 23, 2012, 10:24:37 PM11/23/12
to clj-...@googlegroups.com
I'm using noir 1.3.0-beta10 but also am using compojure (>=1.1.1)directly
for some of the routes (via noir's compojure-route), including OPTIONS
routes for Cross Object Resource Sharing.

The problem I'm having is that the current version of noir
uses compojure.core 1.0.4 which does not have OPTIONS
as does the compojure 1.1.3 (and even 1.1.1).  So the
code will not compile when I use OPTIONS.

Excuse the pun, but what options do I have here?
What is the best policy when library A depends on
an old version of library B but the main code depends on a later version of B?
Will noir likely work as is with the later version of compojure? 
Are there any plans to update noir's compojure dependency soon?

I tried to trick lein into using the more recent version of
compojure on the theory that that would not break noir,
but however I structure the dependencies, it seems to
prefer the older version. (And both libraries are used simultaneously
in my code.)  I'm guessing that I could make a local noir repository
with the updated dependency, but that seems ... inelegant,
and painful for maintenance.  And similarly for ``writing''
compojure's OPTIONS in my code.

I'd appreciate any ideas.  I'm a bit surprised this doesn't come up
in other cases, so maybe (hopefully?) I'm missing something obvious.

Thanks for your help.

Chris Granger

unread,
Nov 23, 2012, 10:33:56 PM11/23/12
to clj-noir
you should be able to exclude compojure from noir and then include whatever version you want.

Something like this:

[noir "1.3.0-beta10" :exclusions [compojure/compojure]]
[compojure "1.1.3"]

Cheers,
Chris.

Anthony Grimes

unread,
Nov 23, 2012, 10:40:11 PM11/23/12
to clj-...@googlegroups.com
I'll be releasing a new version soon. All of the dependencies will be updated.

chisquare05

unread,
Nov 23, 2012, 10:51:14 PM11/23/12
to clj-...@googlegroups.com
Thanks, Chris; that's a big help.  I hadn't realized that that was possible.

Unfortunately, I don't seem to have fixed the problem.  Here are my (new)
dependencies in project.clj, using your suggestion:

  :dependencies [[org.clojure/clojure "1.4.0"]
                           [org.clojure/core.incubator "0.1.2"]
                           [org.clojure/tools.logging "0.2.3"]
                           [clj-logging-config "1.9.10"]

                           [noir "1.3.0-beta10" :exclusions [compojure/compojure]]
                           [compojure "1.1.3"]
                           [cheshire "4.0.3"]
                           [org.clojure/java.jdbc "0.2.2"]
                           [local/postgresql "9.2.1002"]
                           [korma "0.3.0-beta11"]
                           [midje "1.4.0"]]

Then in the ns declaration I :use  [compojure.core    :only [GET POST OPTIONS defroutes context]]
and :require  [noir.response         :as response], ...   [noir.server           :as server]  as usual.
Again OPTIONS causes compilation to fail (everything works if I take that out). I tried variations
on the exclusions option without success.

Have I done something incorrectly?

Thanks again,

   Chris

chisquare05

unread,
Nov 23, 2012, 10:51:46 PM11/23/12
to clj-...@googlegroups.com
That's good new, Anthony. Thanks.

chisquare05

unread,
Nov 23, 2012, 11:53:44 PM11/23/12
to clj-...@googlegroups.com
The :exclusions did work; I just had to do a lein clean first.

Thanks again for your help!
Reply all
Reply to author
Forward
0 new messages