Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SBT configuration vs Ivy module configuration

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.

like image 663
Paul Draper Avatar asked Nov 28 '25 13:11

Paul Draper


1 Answers

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.

like image 122
Eugene Yokota Avatar answered Dec 01 '25 08:12

Eugene Yokota



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!