0

For example:

If I specific the path ~/.m2/repository

When I import some dependencies in cmd line like follow then it can find the jar location by my maven pom file.

[yf@local]java -cp clojure-1.8.0.jar clojure.main
Clojure 1.8.0
user=>
user=> (:import org.apache.commons.lang StringUtils)
yunfan
  • 760
  • 1
  • 11
  • 24

1 Answers1

0

Clojure itself does not do any dependency management at all. For that you need Leiningen, which is clojure's build and dependency management tool, which can work with Maven repo's.

Steps:

  1. install lein script
  2. run lein self-install
  3. do lein new <projectname> to create a new project in the current dir
  4. go into the project dir and edit the project.clj file
  5. add [org.apache.commons\commons-lang3 "3.4"] to the :dependencies vector
  6. run lein repl to update the dependencies / get dependencies from local and start a repl of the project

Also, the (:import [org.apache.commons.lang StringUtils]) can only be used within the (ns ) block. Used outside of the ns block you should do a (import [org.apache.commons.lang StringUtils])

NielsK
  • 6,886
  • 1
  • 24
  • 46