Slamhound无法重建我的ns形式

时间:2015-06-11 10:25:54

标签: clojure

我创建了一个包含两个名称空间的项目,familja-moderne.core和familja-moderne.visualization.svg。

的src / familja_moderne / core.clj

(ns familja-moderne.core
  (:require [clojure.set :as set])
  (:import (java.io ByteArrayInputStream)))

(def try-out
  [(set/map-invert
    {:1 :2
     :3 :4})
   (ByteArrayInputStream. (.getBytes "myBytes"))
   (familja-moderne.visualization.svg/points heists)])

的src / familja_moderne /可视/ svg.clj

(ns familja-moderne.visualization.svg
  (:refer-clojure :exclude [max min]))

(def some-map {:this :that
               :foo :bar})

(def many-dependencies
  {:something (ByteArrayInputStream. (.getBytes "something"))
   :another-map (set/map-invert some-map)})

当我跑步时

lein slamhound code/familja-moderne/src/familja_moderne/visualization/svg.clj

我得到了

WARNING: ex-info already refers to: #'clojure.core/ex-info in namespace: slingshot.ex-info, being replaced by: #'slingshot.ex-info/ex-info
WARNING: ex-data already refers to: #'clojure.core/ex-data in namespace: slingshot.ex-info, being replaced by: #'slingshot.ex-info/ex-data

我不明白,但它有效,我的ns形式被重建为

(ns familja-moderne.visualization.svg
  (:require [clojure.set :as set])
  (:import (java.io ByteArrayInputStream))
  (:refer-clojure :exclude [max min]))

运行

lein slamhound code/familja-moderne/src/familja_moderne/core.clj

失败,我收到以下消息

WARNING: ex-info already refers to: #'clojure.core/ex-info in namespace: slingshot.ex-info, being replaced by: #'slingshot.ex-info/ex-info
WARNING: ex-data already refers to: #'clojure.core/ex-data in namespace: slingshot.ex-info, being replaced by: #'slingshot.ex-info/ex-data
Failed to reconstruct: #<File code/familja-moderne/src/familja_moderne/core.clj>
java.lang.ClassNotFoundException: familja-moderne.visualization.svg, compiling:(NO_SOURCE_PATH:0:0)

运行

lein slamhound code/familja-moderne/src/familja_moderne/

应该重建两个名称空间中的ns表单会产生不同的

WARNING: ex-info already refers to: #'clojure.core/ex-info in namespace: slingshot.ex-info, being replaced by: #'slingshot.ex-info/ex-info
WARNING: ex-data already refers to: #'clojure.core/ex-data in namespace: slingshot.ex-info, being replaced by: #'slingshot.ex-info/ex-data
Failed to reconstruct: #<File code/familja-moderne/src/familja_moderne/core.clj>
Couldn't resolve familja-moderne.visualization.svg, got as far as {:import #{java.io.ByteArrayInputStream}, :alias {clojure.set set}, :old {:load nil, :exclude {}, :xrefer #{}, :require #{}, :refer-all #{}, :verbose #{}, :rename {}, :alias {clojure.set set}, :reload #{}, :reload-all #{}, :gen-class nil, :import #{java.io.ByteArrayInputStream}, :refer {}}, :meta nil, :name familja-moderne.core}

如果我从familja-moderne.core删除对familja-moderne.visualization.svg的任何引用,它就可以了。

1 个答案:

答案 0 :(得分:2)

我遇到了同样的问题,并通过修复程序向Slamhound开了一个公关:https://github.com/technomancy/slamhound/pull/87

您可以通过my fork中的lein install分支dotted-alias来尝试。

我的理论是,这个问题的发生是因为clojure bug CLJ-1403,当Slamhound试图重新生成&#34;时,会抛出异常。 ns形式。

希望有所帮助!