1
votes

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?

1
Not answering your question, but using org.apache.commons/commons-imaging is another option - please have a look at github.com/bsvingen/image-metadata-utils for examples. - bsvingen

1 Answers

1
votes

For one, the class you want to import is:

com.thebuzzmedia.exiftool.ExifTool

Also, by default leiningen fails if the checksum doesn't validate. You want your :repositories key to look like this:

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

You could also set it to :ignore if you prefer. See the sample leiningen project.