SBT configuration vs Ivy module configuration

我的梦境 提交于 2019-12-22 10:57:27

问题


This appears similar to sbt Configuration vs Ivy configuration, though it doesn't seem like this question is asked:

What is the difference between

libraryDependencies += "com.example" % "foo" % "1.0" % "test"

and

libraryDependencies in Test += "com.example" % "foo" % "1.0"

(And a similar question for IntegrationTest / "it".)

Should I always use SBT configuration, or Ivy configuration? Or does it depend on the particular case?

I have seen the former more often, though it seems that the latter is more consistent with the rest of my build.sbt.


回答1:


update task and libraryDependencies are a bit odd ones because when you're downloading JARs you probably don't want to download Compile JARs and Test JARs independently or in parallel. For update task to handle all configurations, libraryDependencies needs to handle all configurations too.

libraryDependencies += "com.example" % "foo" % "1.0" % Test

means your project's Test configuration depends on the default configuration of "com.example" % "foo" % "1.0".

libraryDependencies in Test, I don't think would work.

Should I always use SBT configuration, or Ivy configuration? Or does it depend on the particular case?

There are notational differences, but conceptually sbt's configuration and Ivy configuration is the same thing.



来源:https://stackoverflow.com/questions/28550889/sbt-configuration-vs-ivy-module-configuration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!