java.io.FileNotFoundException:在类路径上找不到clojure/spec/alpha__init.class或clojure/spec/alpha.clj

java.io.FileNotFoundException:在类路径上找不到clojure/spec/alpha__init.class或clojure/spec/alpha.clj,clojure,Clojure,我试图理解Clojure规范。在设置Clojure项目时,我在要求Clojure.spec.alpha时遇到以下错误: Exception in thread "main" java.io.FileNotFoundException: Could not locate clojure/spec/alpha__init.class or clojure/spec/alpha.clj on classpath., compiling: at clojure.lang.Compiler.load(Co

我试图理解Clojure规范。在设置Clojure项目时,我在要求Clojure.spec.alpha时遇到以下错误:

Exception in thread "main" java.io.FileNotFoundException: Could not locate clojure/spec/alpha__init.class or clojure/spec/alpha.clj on classpath., compiling:
at clojure.lang.Compiler.load(Compiler.java:7391)
at clojure.lang.Compiler.loadFile(Compiler.java:7317)
at clojure.main$load_script.invokeStatic(main.clj:275)
at clojure.main$script_opt.invokeStatic(main.clj:335)
at clojure.main$script_opt.invoke(main.clj:330)
at clojure.main$main.invokeStatic(main.clj:421)
at clojure.main$main.doInvoke(main.clj:384)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.lang.Var.invoke(Var.java:379)
at clojure.lang.AFn.applyToHelper(AFn.java:154)
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.main.main(main.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMainV2.main(AppMainV2.java:131)
My project.clj:

(defproject testing "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.9.0"]
                 [org.clojure/spec.alpha "0.1.143"]
                 [org.clojure/core.specs.alpha "0.1.10"]])
和core.clj:

(ns testing.core
  (:require [clojure.spec.alpha :as s]))

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

如果有人能帮我,我会很感激的

我做了一个
lein clean
,它开始工作了

我也有同样的错误,我不知道clojure,但不得不修复一些
NoClassDefFoundError
异常,使用
org.apache.Storm.Kafka.KafkaSpout
测试卡夫卡风暴

第一个例外是:
NoClassDefFoundError:clojure/lang/IFn

我通过在类路径中包含来修复这个问题

接下来,这个例外:

FileNotFoundException:在类路径上找不到clojure/spec/alpha\u init.class或clojure/spec/alpha.clj

后来意识到他们有另一个罐子装这个


希望这对其他人有帮助

对于在1.9中遇到此问题的用户,请参见

使用1.8,您可以运行.m2中的
java-jarclojure-1.8.0.jar
,RELP将立即启动。对于1.9,情况不再如此。您需要默认情况下.m2中可能没有的其他库


不过,如果基于安装Clojure,您将拥有它们

对我有效的方法是添加
测试。将
库作为依赖项检查到我的类路径

同一个项目。clj和core.clj对我有效。我注意到堆栈跟踪中的
com.intellij
;你是怎么运作的?你能从命令行在项目目录中运行
lein repl
吗?你能发布
lein repl
命令的输出吗?
lein repl
对我来说运行正常。您能描述一下您是如何运行它的吗?以下是我尝试运行lein repl时的情况:
lein repl nREPL服务器在主机127.0.0.1的端口61605上启动的-nrepl://127.0.0.1:61605 REPL-y 0.3.7,nREPL 0.2.12 Clojure 1.9.0 Java HotSpot(TM)64位服务器VM 1.8.0_151-b12文档:(此处文档函数名)(此处查找文档“名称的一部分”)Source:(这里的源函数名)Javadoc:(这里的Javadoc java对象或类)Exit:Control+D或(Exit)或(quit)结果:存储在vars*1、*2、*3中,*e
中出现异常,我刚刚尝试运行core.clj请提供一些详细信息(如果有)。如果添加clojure-1.9.0,则storm不会抱怨类路径上有多个版本的clojure?我没有看到该错误。不要期望基于此: