unable to get ns docstring if :main is set in project.clj (meta doc) #575

uvtc opened this Issue May 11, 2012 · 2 comments


None yet

2 participants


This is using lein 2.0.0-preview3.

If I create a new project (lein new foob) and --- touching nothing else --- add a namespace docstring to core.clj, making it look like this:

(ns foob.core
  "docstring for namespace")

then start a repl (lein repl), and do this:

user=> (require 'foob.core)
user=> (meta (the-ns 'foob.core))
{:doc "docstring for namespace"}

You can see I get that docstring.

(Side issue: I can't get the docstring in the usual way,

user=> (doc foob.core)
ClassNotFoundException foob.core  java.net.URLClassLoader$1.run (URLClassLoader.java:217)

but that may be related to http://dev.clojure.org/jira/browse/CLJ-902)

Now, if I go and add ":main foob.core" to my project.clj, then start the repl again:

foob.core=> (meta (the-ns 'foob.core))
foob.core=> (require 'foob.core)
foob.core=> (meta (the-ns 'foob.core))

That metadata appears to be missing.

If I now go back and remove the ":main foob.core" from project.clj (to get back to where I was), and restart the repl, I can't get that doc metadata back again. (!)

I get the same behaviour if I start over, but first change 1.3.0 to 1.4.0 in project.clj.


BTW, thanks to weavejester on irc for helping identify the issue(s)!


This is actually a bug in Clojure.

$ lein compile :all
java -cp `lein classpath` clojure.main -e "(prn (meta (the-ns (doto (quote foob.core) require))))"

The problem is that AOT causes namespaces to lose their metadata: http://dev.clojure.org/jira/browse/CLJ-130

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment