如何将自定义版本传递给sbt发布?

时间:2016-10-13 16:10:40

标签: scala sbt release

我需要将自定义版本传递给SBT发布任务。我目前正在运行这个:

sbt "release with-defaults release-version 1.2.3 next-version 1.3.0"

但我明白了:

[info] Loading project definition from F:\dev\MyProject\project
[info] Set current project to ipo-renew (in build file:/F:/dev/MyProject/)
[error] Expected whitespace character
[error] Expected 'with-defaults'
[error] Expected 'skip-tests'
[error] Expected 'cross'
[error] release with-defaults release-version 20.0.5-XML-Hotfix-1 next-version 20.0.5-XML-Hotfix-2
[error]                       ^

我试过没有引号:

sbt release with-defaults release-version 1.2.3 next-version 1.3.0

但是我得到了一个版本的提示,而不是使用我提供的版本。

据我所知,sbt发布插件文档(https://github.com/sbt/sbt-release)我正在传递正确的内容 - 任何想法为何被忽略?我最终需要这个来从TeamCity中的命令行步骤...

我也尝试省略'with-defaults'选项,但它对结果没有影响。但是只运行

sbt release with-defaults 

正确地没有提示我并使用我们在version.sbt中的版本。

1 个答案:

答案 0 :(得分:2)

首先,请确保您使用the latest sbt-release version(截至2016年10月18日目前为1.0.3):

addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.3")

运行with-defaults作为命令的最后一个参数:

sbt "release release-version 1.2.3 next-version 1.3.0 with-defaults"

这里是在TeamCity中运行的输出:

[19:46:27]  [Step 2/2] [info] Checking remote [origin] ...
[19:46:32]  [Step 2/2] [info] Setting version to '1.2.3'.
[19:46:32]  [Step 2/2] [info] Reapplying settings...
[19:46:34]  [Step 2/2] [info] Set current project to ***
[19:46:34]  [Step 2/2] [info] [development 7302685] Setting version to 1.2.3
[19:46:34]  [Step 2/2] [info]  1 file changed, 1 insertion(+), 1 deletion(-)
[19:46:34]  [Step 2/2] [info] Reapplying settings...
[19:46:35]  [Step 2/2] [info] Set current project to ***
[19:46:35]  [Step 2/2] [info] git push sends its console output to standard error, which will cause the next few lines to be marked as [error].
[19:46:36]  [Step 2/2] [error] To ****
[19:46:36]  [Step 2/2] [error]    4342272..7302685  development -> development
[19:46:37]  [Step 2/2] [error] Everything up-to-date