生成自动化-sbt:针对多个依赖项进行编译/测试 [英] Build-automation - sbt: Compile/Test against multiple dependencies

查看:68
本文介绍了生成自动化-sbt:针对多个依赖项进行编译/测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们刚刚发布了库的一部分( Mango ),它是围绕 Google Guava Java通用库.

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

该库当前依赖于Google Gauva 14.0,但我们也想添加对其他版本的支持.

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

sbt (一种用于Scala和Java项目的构建自动化工具)中是否有一种方法可以创建类似Maven的配置文件,其中每个配置文件根据各自的Guava依赖项的不同版本进行编译,因此我们可以将其包含在连续集成测试矩阵中?

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?

理想情况下,应该可以通过以下方式调用sbt:

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

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

推荐答案

您应检查以下链接:我知道您不想进行测试,但是如您所见,我们可以创建不同的SBT配置. 您可能将能够从以下方面获得启发,并能够创建配置和任务以便可以运行:

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:编译
  • 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 :)

您还可以添加交叉构建

顺便说一句好图书馆的想法.

Nice library idea by the way.

这篇关于生成自动化-sbt:针对多个依赖项进行编译/测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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