ssloan ssloan - 6 days ago 6x
Scala Question

How to pass custom version to sbt release?

I need to pass a custom version to the SBT release task. I'm currently running this:

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

But I get this:

[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] ^

I've tried without the quotes:

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

But I then get prompted for a version, rather than it using the ones I've supplied.

As far as I can tell from the sbt release plugin docs ( I'm passing the right stuff in - any ideas why it's ignored? I eventually need this to work from a command line step in TeamCity...

I've also tried omitting the 'with-defaults' option but it makes no difference to the result. However running just

sbt release with-defaults

correctly doesn't prompt me and uses the version we have in version.sbt.


First, make sure you're using the latest sbt-release version (currently 1.0.3 as of 18/10/2016):

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

Run with-defaults as the last argument of the command:

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

Here's the output from running inside 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