当运行时,即使它们在后面的编译中不再被包含,标记为的依赖项仍然会被解析。看起来这只应该在任务期间发生。有没有一种方法可以在任务期间排除依赖项的解析和下载?
这里有一个示例,使用依赖项进行说明,我将其声明为仅限测试:
这里有一个示例,使用依赖项进行说明,我将其声明为仅限测试:
"org.mockito" % "mockito-all" % "1.9.0" % "test"
然而,当(从本地的Ivy缓存中清除并)运行sbt compile
时,它会被不必要地下载:
$ sbt compile
[info] 从 /Users/rbrainard/.sbt/plugins 加载全局插件
[info] 从 /Users/rbrainard/Development/spitball/project 加载项目定义
[info] 将当前项目设置为 spitball(在 build file:/Users/rbrainard/Development/spitball/ 中)
[info] 正在更新 {file:/Users/rbrainard/Development/spitball/}spitball...
[info] 正在解析 org.mockito#mockito-all;1.9.0 ...
[info] 正在下载 http://repo1.maven.org/maven2/org/mockito/mockito-all/1.9.0/mockito-all-1.9.0.jar ...
[info] [成功] org.mockito#mockito-all;1.9.0!mockito-all.jar(2075ms)
[info] 更新完成。
[success] 总共用时:7秒,已于May 28, 2014 4:51:20 PM完成。
last update
显示confs: [compile, runtime,test,...]
。那不能更新吗? - ryanbrainardallDependencies
设置来删除你不想要的配置文件的所有依赖项。但在撤销此操作之前,您将无法运行测试。 - jsuereth