SBT配置与Ivy模块配置 [英] SBT configuration vs Ivy module configuration

查看:225
本文介绍了SBT配置与Ivy模块配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这看起来类似于 sbt配置与常春藤配置,尽管它没有似乎是在问这个问题:



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

  libraryTest中的依赖+ = com.example% foo% 1.0 

(还有 IntegrationTest / 的类似问题它。



我应该始终使用SBT配置还是常春藤配置?还是取决于具体情况?



我看过前者的频率更高,尽管后者似乎与我的build.sbt其余部分更加一致。

解决方案

update 任务和 libraryDependencies 有点奇怪,因为当您下载JAR时,您可能不想下载 Compile JAR和 Test JAR独立或并行。对于 update 任务来处理所有配置, libraryDependencies 也需要处理所有配置。

  libraryDependencies + = com.example% foo% 1.0%测试

表示项目的 Test 配置取决于 com.example%的默认配置foo% 1.0



libraryDependencies in Test ,我不


我应该始终使用SBT配置还是常春藤配置?还是取决于具体情况?


存在符号上的区别,但是从概念上讲,sbt的配置和Ivy的配置是相同的。 / p>

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.

解决方案

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.

这篇关于SBT配置与Ivy模块配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆