问题描述
我有以下 build.sbt
:
name := "it-config-sbt-project"
scalaVersion := "2.10.4"
Defaults.itSettings
lazy val `it-config-sbt-project` = project.in(file(".")).configs(IntegrationTest)
我怎样才能在添加IntegrationTest 配置的地方划线 更简单?
How could I make the line where I add the IntegrationTest configuration even simpler?
我宁愿有一个包含当前配置和项目设置的设置,例如
I would rather like to have a setting with current configurations and settings of the project, e.g.
settings ++= Defaults.itSettings
configs += IntegrationTest
或者甚至使用 sbt 文件中的以下行自动应用 itSettings
设置:
or even have the itSettings
settings applied automatically with the following line in the sbt file:
configs += IntegrationTest
推荐答案
sbt 在评估设置之前需要了解委派的配置.因此,无法在设置系统中定义配置.
sbt needs to know the configurations for delegation before evaluating settings. So, configurations can't be defined inside the settings system.
请注意,如果使用的配置不会扩展
另一个配置,则不一定需要使用 configs
方法将其注册到项目中.
Note that if using a configuration that doesn't extend
another configuration, it isn't strictly necessary to register it on the Project with the configs
method though.
这篇关于sbt 0.13.x 中 IntegrationTest 配置的最小设置是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!