1

In my luminus project I've added this:

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

to the list of dependencies but this throws an exception still:

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

which is:

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

1 Answers1

2

here is a working example to compare with:

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"]])

from 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) has been deprecated by the require :refer pattern.

And here are some common things to check:

  • you have actually fetched the dependencies since adding them to the project.clj file

  • Try running lein deps from the command line to make sure fetching the dependencies worked

  • restart cider (if in emacs)
  • try from lein repl
  • if none of this works look in ~/.m2/repository and make sure the class files are there
  • run ps -ef (if in linux) to look at the command used to start java and make sure the classpath contains your dependency.
Arthur Ulfeldt
  • 90,827
  • 27
  • 201
  • 284