copy-deps is a Leiningen plugin to copy dependencies into your project's resources. This is necessary in the case of Java agents for example, which have to be present as jars outside the uberjar, or native library dependencies.
In your project.clj
, in the :plugins
section, add:
To run this plug in, execute:
$ lein copy-deps
If you want the task to run automatically, which is recommended, add:
:prep-tasks ["javac" "compile" "copy-deps"]
and it'll be invoked every time you build your uberjar. The essential plug-in configuration goes into your project.clj
and looks like this:
:copy-deps {:destination "resources/jars"}
:destination
specifies where to copy the jars. You can then specify the jars you want to copy in this fashion:
:copy-deps {:dependencies [[org.clojure/clojure "1.7.0"]]
:destination "resources/jars"}
or, if you have :java-agents
in your project, there's a shortcut to just copy them:
:jar-copier {:java-agents true
:destination "resources/jars"}
They can both be mixed if desired.
A full example using Java agents can be found in proclodo-spa-server-rendering:
(defproject proclodo-spa-server-rendering "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.7.0"]]
:plugins [[jar-copier "0.1.0"]]
:prep-tasks ["javac" "compile" "jar-copier"]
:java-agents [[com.newrelic.agent.java/newrelic-agent "3.20.0"]]
:copy-deps {:java-agents true
:destination "resources/jars"})
jar-copier
to copy-deps
.jar
.Copyright © 2015-2017 José Pablo Fernández Silva
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.
Can you improve this documentation? These fine people already did:
J. Pablo Fernández, Ted Cushman, Ryan Fowler & The Gitter BadgerEdit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close