Question

To add a dependency to a clojurescript project, you can include it with

:dependencies [[dependency/thing "0.0.1"]]

however, I have multiple targets in my leiningen file for clojurescript

:cljsbuild {
    :builds {
      :target1 {...}
      :target2 {...}}}

and I would like to have the dependency be only present for one of the two targets. Is there a way to do this?

Was it helpful?

Solution

You can do this using leiningen profiles. For example, I have a test dependency in my :test profile that is used for my :test build but not for my regular build:

:cljsbuild {
  :builds {
    :main {...}
  }}

:profiles {
  :test {
    :dependencies [["test-dep" "1.0.0"]]
    :cljsbuild {
      :builds {
        :test {...}
  }}}}

The test dependency is only added to the project when the test profile is active, so it won't get added to your pom.xml file, for example, and it won't get compiled into your main build.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top