如何在Leiningen中声明测试范围依赖关系



如何声明仅在测试中使用的依赖项,即部署的工件不需要它们?

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"]]})

Leiningen的文件上说:

:dev配置文件用于指定特定于项目的开发工具。如果构建或测试需要,请将内容放在此处,而不仅仅是方便的工具。

最新更新