【问题标题】:Could not locate clojure/data/xml__init.class in a luminus project无法在 luminus 项目中找到 clojure/data/xml__init.class
【发布时间】:2016-08-19 07:13:22
【问题描述】:

在我的 luminus 项目中,我添加了这个:

[org.clojure/data.zip "0.1.2"]

到依赖列表,但这仍然会引发异常:

(ns myapp.rss
  (:use [clojure.data.xml :as xml :only [emit]]))

这是:

Could not locate clojure/data/xml__init.class or clojure/data/xml.clj on classpath

【问题讨论】:

    标签: clojure luminus


    【解决方案1】:

    这是一个可以与之比较的工作示例:

    project.clj:

    (defproject hello "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"}
      :main hello.core
      :dependencies [[org.clojure/clojure "1.7.0"]                 
                     [org.clojure/data.xml "0.0.8"]
                     [org.clojure/data.zip "0.1.2"]
                     [clj-http "2.2.0"]])
    

    来自 core.clj:

    (ns hello.core
      (:require [clj-http.client :as http-client]
                [clojure.zip :as zip]
                [clojure.xml :as xml]
                [clojure.data.xml :as xml-data :refer [emit]]
                [clojure.data.zip.xml :as xml-z]))
    

    (use ... :only) 已被require :refer 模式弃用。

    以下是一些需要检查的常见事项:

    • 自从将依赖项添加到 project.clj 文件后,您实际上已经获取了依赖项

    • 尝试从命令行运行 lein deps 以确保获取依赖项有效

    • 重启苹果酒(如果在 emacs 中)
    • 试试lein repl
    • 如果这些都不起作用,请查看 ~/.m2/repository 并确保类文件在那里
    • 运行 ps -ef(如果在 linux 中)查看用于启动 java 的命令并确保类路径包含您的依赖项。

    【讨论】:

      猜你喜欢
      • 2018-09-22
      • 2018-02-19
      • 2016-09-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多