如何声明仅在测试中使用的依赖项,即部署的工件不需要它们?
相当于maven是<scope>test</scope>
:
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
相当于sbt是% "test"
:
libraryDependencies += "org.apache.derby" % "derby" % "10.4.1.3" % "test"
最佳答案
将其添加到 :dev
配置文件中:
(defproject your-project "1.0.0"
:dependencies [[some-normal-library "1.0.0"]]
:profiles {:dev {:dependencies [[some-test-library "1.0.0"]]})
莱宁根文档 profiles说:
The :dev profile is used to specify project specific development tooling. Put things here if they are required for builds or tests, rather than just convenience tooling.
关于testing - 如何在 Leiningen 中声明测试范围依赖项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58679933/