1

If I add the following require:

(ns project.core
  (:require
     [compojure.route          :as route])
  (:gen-class))

(defn -main [& {:as args}]
  (println "hello"))

an do

lein run

I get

Syntax error macroexpanding clojure.core/ns at (ring/util/mime_type.clj:1:1).
((require [clojure.string :as str])) - failed: Extra input spec: :clojure.core.specs.alpha/ns-form

is there a way I can get "compojure.route not found; not defined; or whatever" e.g. something meaningful? if I remove it it works fine. e.g. it says Hello

using Leiningen 2.9.4 on Java 14.0.1 OpenJDK 64-Bit Server VM

1 Answer 1

2

The project you are using is using very old dependencies. Clojure spec (introduced "recenlty") added macro/compile time checks and the mentioned file there triggers it.

compojure.route actually is found and it then requires its transitive deps. And while going down the chain ring.util.mime-type is required and the version you are using is not ready for current Clojure versions.

Your best bet here is to upgrade your deps. E.g. if you are following a book or if you are using a template this things can happen. If you have lein-ancient installed, it can attempt the update for you. Otherwise your best bet is to start in your project.clj and compare versions (e.g. check clojars).

If the problem still persists, have a look at lein deps :tree and see what is going on with the transtive deps.

Sign up to request clarification or add additional context in comments.

2 Comments

For the record: it was fixed six years ago: github.com/ring-clojure/ring/commit/…
Thanks for the explanation lein deps: tree showed where the old dependency was

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.