P. Str
P. Str

Reputation: 670

Include many jars in clojure resource-paths

Till now I add some jars under lib/ folder and then I write "lib/a.jar" in "resources-path" field inside project.clj. Now I want to add 20 jars. Is there a better and shorter to way to declare these jars instead of explicitly define each jar one-by-one?

Upvotes: 0

Views: 339

Answers (1)

Sam Estep
Sam Estep

Reputation: 13324

In Leiningen projects, the standard way to handle dependencies is to add them to your :dependencies vector in project.clj. For instance, if your only dependencies are GAX-Java and Clojure itself, your dependencies vector would look like this:

:dependencies [[org.clojure/clojure "1.8.0"]
               [com.google.api/gax "0.0.13"]]

By default, Leiningen will look for dependencies in the Maven Central and Clojars repositories, so in this case, it will find this artifact for Clojure and this artifact for GAX-Java.

If you need a library that's available in a different repository, but is not available in Central or Clojars, you can add that repository as explained in the Leiningen tutorial.

Finally, if you need a library that can't be found in any Maven repository, you can download the JAR manually and put it in a directory in your :resource-paths, but that isn't generally recommended and should only be used as a last resort.

Upvotes: 1

Related Questions