gpt4 book ai didi

java - emacs & clojure 编译错误

转载 作者:行者123 更新时间:2023-12-04 05:06:07 24 4
gpt4 key购买 nike

我是 clojure & emacs 的初学者。
我正在 clojure-doc.org 上关注 clojure 和 emacs 的教程。
在我用 lein 创建了我的测试项目之后,在 emacs 中启动了 nrepl 和
编辑 core_test.clj 我试图编译。

然后我得到了这个:

Loading /home/jakov/dev/PROJECTS/clojure/test1/test/test1/core_test.clj...
FileNotFoundException Could not locate test1/core__init.class or test1/core.clj on
classpath: clojure.lang.RT.load (RT.java:432)

我的项目是用 leiningen 2 创建的,作者是 lein new test1 .
我正在使用 emacs24

这里可能有什么问题?

编辑:
这是我的项目的文件结构:
.
./doc
./doc/intro.md
./.gitignore
./README.md
./project.clj
./src
./src/test1
./src/test1/core.clj
./test
./test/test1
./test/test1/core_test.clj

编辑:

这是我的文件:

core_test.clj
(ns test1.core-test
(:use clojure.test
test1.core))

(deftest pairs-of-values
(let [args ["--server" "localhost"
"--port" "8080"
"--environment" "production"]]
(is (= {:server "localhost"
:port "8080"
:environment "production"}
(parse-args args)))))

core.clj
(ns test1.core)

(defn foo
"I don't do a whole lot."
[x]
(println x "Hello, World!"))

正如我所理解的,这应该给我另一个错误,
据我了解,它应该提示解析参数。
但是,当我将它添加到 时,会发生同样的错误。 core.clj :
(defn parse-args [args]
{})

最佳答案

这就是问题所在:

emacs 似乎需要在启动 nrepl 之前知道项目的路径 nrepl-jack-in .
但是,如果您只使用 nrepl 启动 nrepl并将其连接到在单独的终端窗口中启动的 repl 进程的端口,然后 emacs 将从它连接到的 repl 进程中知道 out 路径等。

所以,为了让事情与 nrepl-jack-in 一起工作,你需要先打开一个工程文件,比如core.cljcore_test.clj然后开始 nrepl-jack-in .

github 上的 Nrepl 页面添加了以下内容:
您可以使用的替代方法 C-u M-x nrepl-jack-in指定 lein 项目的名称,而无需访问其中的任何文件。

关于java - emacs & clojure 编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15511840/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com