1

I'm trying to include exiftool for java in a leiningen based clojure project. This library is not available at central, so I have included a :repository tag in my project.clj file.

project.clj:

(defproject clojure-mongo "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"}
  :repositories {"The Buzz Media Maven Repository" "http://maven.thebuzzmedia.com"}
  :dependencies [[org.clojure/clojure "1.7.0"]
                 [com.novemberain/monger "3.0.1"]
                 [com.thebuzzmedia/exiftool-lib "1.1"]])

exiftool for java does not provide a checksum and the site warns of this:

"NOTE: At this time we are not providing checksums for the files on our repository, so you will see '[WARNING] Checksum validation failed' messages from Maven, but they can be safely ignored."

Sure enough, lein deps gives me an error although I am not convinced it is safe to ignore:

"Retrieving com/thebuzzmedia/exiftool-lib/1.1/exiftool-lib-1.1.pom from The Buzz Media Maven Repository Could not transfer artifact com.thebuzzmedia:exiftool-lib:pom:1.1 from/to The Buzz Media Maven Repository (http://maven.thebuzzmedia.com): Checksum validation failed, no checksums available from the repository"

Attempting to import the ExifTool class in my clojure code still gives me a ClassNotFoundException.

core.clj:

(ns clojure-mongo.core
  (:require [monger.core :as mg]
            [monger.collection :as mc])
  (:import [com.mongodb MongoOptions ServerAddress]
           org.bson.types.ObjectId
           com.thebuzzmedia.exiftool-lib.ExifTool))

What can I do to get access to this class from within clojure?

4

1 回答 1

1

一方面,您要导入的类是:

com.thebuzzmedia.exiftool.ExifTool

此外,如果校验和未验证,默认情况下 leiningen 会失败。您希望您的:repositories密钥看起来像这样:

:repositories [["The Buzz Media Maven Repository" 
               {:url "http://maven.thebuzzmedia.com"  :checksum :warn}]]

如果您愿意,也可以将其设置为:ignore。请参阅示例 leiningen 项目

于 2015-10-10T17:32:16.687 回答