这非常重要,我在截止日期前完全被困住了。非常感谢帮助。
我有一个名为red-black的Clojure项目,它特别包含一个名为interval_tree.clj的文件
我一直在用lein uberjar编译这个项目,然后在其他项目中使用生成的jar,将它安装在本地maven存储库中。
mvn install:install-file \
-Dfile=../red-black/target/red-black-0.1.0.jar \
-DgroupId=self \
-DartifactId=red-black \
-Dversion=0.1.0 \
-Dpackaging=jar \
-DgeneratePom=true \
-DcreateChecksum=true \
-DlocalRepositoryPath=local_mvn_repo
疯狂的是,我添加了一个新函数,编译了我的jar并将其重新安装在另一个项目的本地maven存储库中,现在java无法找到我的新函数
user=> (red-black.interval-tree/tree-to-flat-list )
CompilerException java.lang.RuntimeException: No such var: red-black.interval-tree/tree-to-flat-list, compiling (NO_SOURCE_PATH:1:1)
但是这个函数是red-black.interval-tree.clj!我甚至进入了我的local_mvn_repo,解压缩了jar,并查看了interval_tree.clj源代码。功能在那里!
更奇怪的是,该库中的其他功能是可访问的。例如,在我的第二个项目中使用本地mvn repo:
user=> (use 'red-black.interval-tree)
nil
现在有一个小标签选项卡魔术:
user=> (red-black.interval-tree/
red-black.interval-tree/add-to-result red-black.interval-tree/black red-black.interval-tree/check-max-interval
red-black.interval-tree/get-color red-black.interval-tree/get-hash red-black.interval-tree/get-interval
red-black.interval-tree/get-key red-black.interval-tree/get-left red-black.interval-tree/get-max
red-black.interval-tree/get-parent red-black.interval-tree/get-right red-black.interval-tree/get-root
red-black.interval-tree/get-sentinel red-black.interval-tree/get-value red-black.interval-tree/has?
red-black.interval-tree/health-check red-black.interval-tree/high red-black.interval-tree/insert
red-black.interval-tree/insert-fixup red-black.interval-tree/left-rotate red-black.interval-tree/low
red-black.interval-tree/max-of-three red-black.interval-tree/new red-black.interval-tree/node
red-black.interval-tree/point-lookup red-black.interval-tree/pretty-print red-black.interval-tree/recursive-max
red-black.interval-tree/red red-black.interval-tree/right-rotate red-black.interval-tree/set-color
red-black.interval-tree/set-interval red-black.interval-tree/set-key red-black.interval-tree/set-left
red-black.interval-tree/set-max red-black.interval-tree/set-parent red-black.interval-tree/set-right
red-black.interval-tree/set-root red-black.interval-tree/set-value red-black.interval-tree/update-max
user=> (red-black.interval-tree/
但是你可以看到缺少了funstion树到平面列表。当我回到我的红黑项目并启动repl时,我可以调用该项目。救命!截至5个小时前,我正在我的红黑项目中创建新方法,编译我的uberjar并通过本地maven安装将其安装到我的其他项目中,并且正在采用新的方法。有些事情似乎非常错误,请指教!
更新
此问题的自包含示例位于此tarball中:
http://gorillamatrix.com/files/foo.tar.gz
进入foo-two和lein repl。尝试加载foo-two.core,你应该看到:
user=> (use 'foo-two.core)
CompilerException java.lang.RuntimeException: No such var: foo-one.core/bar, compiling:(foo_two/core.clj:6:2)
然而foo-one.core / bar肯定是定义的!
答案 0 :(得分:5)