You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何配置cider-find-var跳转到依赖项目的原始源码文件?

解决方法

1. 调整Leiningen(lein)依赖配置

在principal项目的project.clj中,将supporting的Maven坐标依赖替换为本地路径引用,让lein优先加载本地源码而非.m2仓库里的编译包:

;; 替换前
:dependencies [[supporting "1.2.15"]]

;; 替换后
:dependencies [[supporting "1.2.15" :local/root "~/projects/supporting"]]

2. 调整Shadow-cljs依赖配置

在principal项目的shadow-cljs.edn中,修改依赖配置指向本地supporting项目:

;; 方式1:直接替换依赖项
:dependencies [[supporting/local "1.2.15" :local/root "~/projects/supporting"]]

;; 方式2:通过:extra-deps添加本地依赖
:extra-deps {supporting/local {:local/root "~/projects/supporting"}}

3. 确保CIDER关联本地源码

  • 检查Emacs配置中是否开启了类路径增强功能(最新版CIDER默认开启),若未开启,在init.el中添加:
    (setq cider-enrich-classpath t)
    
  • 若上述配置生效仍有问题,在principal项目的CIDER REPL中手动添加supporting的源码目录到类路径:
    (add-classpath "~/projects/supporting/src")
    

注意事项

  • 确保supporting项目的源码结构符合Clojure规范,比如supporting.core对应src/supporting/core.clj(Clojure)或src/cljs/supporting/core.cljs(ClojureScript)文件。
  • 修改配置后,重启CIDER REPL,确保新的依赖配置生效,旧REPL会保留之前的类路径。

内容的提问来源于stack exchange,提问作者Pedro Delfino

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.20 07:48:27