我正在使用基座指南中的初学者指南,但当尝试使用命名空间(要求‘测试)时,我会得到以下错误混乱:“在user/REPL 2012处执行错误(FileNotFoundException) (REPL:1)。无法在类路径上找到test__init.class、test.clj或test.cljc。”
同样的事情在尝试时也会发生(要求“你好”)。
我在用莱茵瑞尔。
我有一个名为test的目录,在src下面有一个名为test.clj的文件。
test/src/test.clj:
(ns test
(:require [io.pedestal.http :as http]
[io.pedesteal.http.route :as route]))test/src/hello.clj:
(defn respond-hello [request]
{:status 200 :body “Herllo world”})有什么想法吗?
测试/部门:
:deps
{io.pedestal/pedestal.service {:mvn/version "0.5.7"}
io.pedestal/pedestal.route {:mvn/version "0.5.7"}
io.pedestal/pedestal.jetty {:mvn/version "0.5.7"}
org.slf4j/slf4j-simple {:mvn/version "1.7.28"}}
:paths ["src"]}发布于 2021-03-19 22:04:06
clj lein repl**. repl与repl不同要使用** lein repl**,,您需要一个project.clj文件。
我使用建议的底座初学者指南成功地通过了clj,但在使用lein repl时得到了错误
user=> (require 'test)
Execution error (FileNotFoundException) at user/eval2006 (REPL:1).
user=> (require 'hello)
Execution error (FileNotFoundException) at user/eval2008 (REPL:1).
Could not locate hello__init.class, hello.clj or hello.cljc on classpath.我查看了clj项目和Leiningen项目之间的区别,下面是我看到的:
:paths ["src"]。莱宁根拥有:main和:target-path in project.clj因此,为了从clj切换到lein repl,添加了以下project.clj文件:
(defproject pedestal "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.10.1"]
[io.pedestal/pedestal.service "0.5.7"]
[io.pedestal/pedestal.route "0.5.7"]
[io.pedestal/pedestal.jetty "0.5.7"]]
:main ^:skip-aot test
:target-path "target/%s")按照我的目录结构..。
.../pedestal/src/test.clj
.../pedestal/project.clj
.../...当我再次启动它时,我甚至不需要(require 'test),甚至不需要(test/start)。(start)做到了这一点,并且页面将加载

莱宁根不同于普通的clj工具。它指向启动文件(?)与指南推荐的基本clj项目不同,并且引入依赖关系的方式也不同。
从你的问题中,我没有看到提到一个project.clj,所以也许这就是你所需要的。
https://stackoverflow.com/questions/66706733
复制相似问题