Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lein codox classpath problem #113

Closed
matthewrfellows opened this issue Jan 5, 2016 · 8 comments
Closed

lein codox classpath problem #113

matthewrfellows opened this issue Jan 5, 2016 · 8 comments

Comments

@matthewrfellows
Copy link

When trying to run lein codox, I'm getting this error:

java.io.FileNotFoundException: Could not locate clojure/tools/reader/impl/ExceptionInfo__init.class or clojure/tools/reader/impl/ExceptionInfo.clj on classpath.

For context, lein version returns Leiningen 2.5.3 on Java 1.7.0_65 Java HotSpot(TM) 64-Bit Server VM. I'm running on OSX 10.9.5.

Perhaps it's related to this issue (taoensso/sente#181 (comment) ; see also http://yogthos.net/posts/2015-12-26-AOTGotchas.html). On the other hand, the project itself compiles just fine, I only get this error when trying to generate the docs.

Here's the project file, for more context.

(defproject api-web "0.2.3"
  :description "REST API"
  :aot :all
  :main api-web.core
  :dependencies [ [org.clojure/clojure "1.7.0"]
                  [compojure "1.4.0" :exclusions [commons-codec]]
                  [ring/ring-devel "1.4.0"]
                  [ring/ring-core "1.4.0" :exclusions [clj-time org.clojure/tools.reader]]
                  [javax.servlet/servlet-api "2.5"] ; necessary for ring
                  [http-kit "2.1.19"]
                  [cheshire "5.5.0"]
                  [simple-time "0.2.0" :exclusions [joda-time]]
                  [com.taoensso/timbre "4.1.4" :exclusions [org.clojure/tools.reader]]
                  [com.fasterxml.jackson.core/jackson-annotations "2.6.0"]
                  [prismatic/schema "1.0.4"]
                  ]
  :profiles {:dev {:dependencies [[org.clojure/test.check "0.9.0"]]}}
  :jvm-opts ["-XX:MaxPermSize=256m"]
  :war-resources-path "war-resources"
  :plugins [[lein-ring "0.9.7"]
            [lein-codox "0.9.1"]]
  :codox {:metadata {:doc/format :markdown}}
  :ring { :handler api-web.core/app
          :init api-web.core/init-app
          :destroy api-web.core/exit-app}
  :repl-options {:timeout 50000})
@weavejester
Copy link
Owner

It sounds like you're having an issue with out of date class files. What happens if you run:

lein do clean, codox

Does it work then?

@matthewrfellows
Copy link
Author

Unfortunately, no, I still get that error.

On Tue, Jan 5, 2016 at 2:18 PM, James Reeves notifications@github.com
wrote:

It sounds like you're having an issue with out of date class files. What
happens if you run lein do clean, codox? Does it work then?


Reply to this email directly or view it on GitHub
#113 (comment).

@weavejester
Copy link
Owner

Do you have any plugins or dependencies in your ~/.lein/profiles.clj file?

@matthewrfellows
Copy link
Author

Good thought.
I did have some plugins, but I just removed all those and tried again (lein
clean, lein codox), and the problem still shows up.

On Tue, Jan 5, 2016 at 2:53 PM, James Reeves notifications@github.com
wrote:

Do you have any plugins or dependencies in your ~/.lein/profiles.clj file?


Reply to this email directly or view it on GitHub
#113 (comment).

@weavejester
Copy link
Owner

Hm, I still can't reproduce the problem you have. I've cleared my profiles.clj in case anything in that was making it work on my machine. I have the same Leiningen version. I'm using the project.clj file you supplied. Codox works fine for me no matter what I do.

Is it possible to post your full source, or put together a sample project that reproduces the problem?

@matthewrfellows
Copy link
Author

Thanks for looking into it.
The full source would be a bit overwhelming. I will try to whittle it down
to a minimal set that reproduces the issue.

On Tue, Jan 5, 2016 at 6:34 PM, James Reeves notifications@github.com
wrote:

Hm, I still can't reproduce the problem you have. I've cleared my
profiles.clj in case anything in that was making it work on my machine. I
have the same Leiningen version. I'm using the project.clj file you
supplied. Codox works fine for me no matter what I do.

Is it possible to post your full source, or put together a sample project
that reproduces the problem?


Reply to this email directly or view it on GitHub
#113 (comment).

@matthewrfellows
Copy link
Author

I've found a very minimal project that does reproduce the problem, and it does seem related to the taoensso.timbre, taoensso.encore issue (taoensso/sente#181).

Run lein new app codoxtest2, and then replace the project.clj and core.clj files with the following to reproduce the issue. If you comment out the :aot :all line in the project file, below, lein codox works fine.

project.clj

(defproject codoxtest2 "0.1.0-SNAPSHOT"
  :dependencies [[org.clojure/clojure "1.7.0"]
                 [com.taoensso/timbre "4.1.4"]]
  :plugins [[lein-codox "0.9.1"]]
  :aot :all
  :main codoxtest2.core)

core.clj

(ns codoxtest2.core
  (:gen-class)
  (:require [taoensso.timbre :refer [warnf warn]]))

(defn -main
  "I don't do a whole lot ... yet."
  [& args]
  (println "Hello, World!"))

@matthewrfellows
Copy link
Author

Well, here's a resolution, of sorts.

If, in my full project, I remove the :aot :all line from project.clj, and then do lein codox, I get all sorts of errors that look something like:
Could not generate clojure documentation for api-web.core - root cause: clojure.lang.Compiler$CompilerException java.lang.ExceptionInInitializerError ...

In this case, lein codox does "finish" generating documentation, but it is, effectively, empty.

If, on the other hand, I remove :aot :all from the project.clj files for all of my local projects on which the project in question depends, then lein codox works fine.

This definitely seems to be a more general dependency issue, not directly related to codox.

I think I can work around the issue by adding :uberjar {:aot :all} to the profiles map in the project files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants