Build-automation - sbt: Compile/Test against multiple dependencies

别等时光非礼了梦想. 提交于 2019-12-21 04:12:43

问题


We just published parts of our library (Mango) which is a Scala wrapper around Google Guava common libraries for Java.

The library currently depends on Google Gauva 14.0, but we would like to add support for other versions as well.

Is there a way in sbt, a build-automation tool for Scala and Java projects, to create maven like profiles, where each profile compiles against a different version of the respective Guava dependency, so we can include it in the continuous integration test matrix?

Ideally, it should be possible to call sbt with something like:

sbt test guava:14.0
sbt test guava:13.0
...

回答1:


You should check this link: Custom test configuration

I know you don't want to do tests but as you can see, we can create different SBT configuration. You will probably be able to take inspiration of the following, and be able to create configurations and tasks so that you can run:

  • guava13:compile
  • guava14:compile
  • guava13:test
  • guava14:test

And you can perhaps try to add the dependencies as follow:

libraryDependencies += "com.google.guava" % "guava" % "13.0" % "guava13"
libraryDependencies += "com.google.guava" % "guava" % "14.0" % "guava14"

So that the dependency is scoped to the guava version configuration you use.

Never done this, can't be sure :)

You can also add cross-build

Nice library idea by the way.



来源:https://stackoverflow.com/questions/17922339/build-automation-sbt-compile-test-against-multiple-dependencies

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