I've been trying to understand what "compile->compile;test->test" is for, but after reading in sbt page still I don't understand it ...
Let's say I have this in build.sbt
lazy val `api` = project.dependsOn(`domain` % "compile->compile;test->test")
...
lazy val `domain` = project...
What's the difference if I remove "compile->compile;test->test"
lazy val `api` = project.dependsOn(`domain`)
...
lazy val `domain` = project...
What if I only put "test->test"? Or "compile->compile"?
Useful commands to see what is going on are
show api / Test / dependencyClasspath
show api / Compile / dependencyClasspath
which will reveal the exact classpaths.
if I remove "compile->compile;test->test"
lazy val api = project.dependsOn(domain)
is equivalent to
lazy val api = project.dependsOn(domain % "compile->compile")
and means api / Compile configuration depends on domain / Compile. If you execute show api / Test / dependencyClasspath then you should see domain's test classpath is not present.
What if I only put "test->test"?
lazy val api = project.dependsOn(domain % "test->test")
means api / Test depends on domain / Test and executing show api / Test / dependencyClasspath should reveal domain's test classpath being present. However executing show api / Compile / dependencyClasspath should reveal domain's compile classpath not being present.
Hence if you want api / Test to depend on domain / Test, and api / Compile to depend on domain / Compile, then you have to specify
lazy val api = project.dependsOn(domain % "compile->compile;test->test")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With