将SNAPSHOT转换为里程碑的方法有哪些?

时间:2014-08-02 01:38:18

标签: sbt

我试图在脚本中使用sbt 0.12在现有的sbt项目中设置一个里程碑。

在Apache Maven中,我使用mvn versions:set Version=foo方法使用versions-maven-plugin创建符合semver的版本。

我很欣赏一些指导?

1 个答案:

答案 0 :(得分:1)

sbt-release插件的方式

使用sbt-release

follows the semantic versioning scheme on semver.org插件

设置和会话保存

鉴于the comment您已经询问类似于&#34; mvn版本的内容:set Version = foo&#34;函数我可以从脚本调用。它应该可以轻松使用 no 附加插件 - 它是sbt - settings的内置功能。<​​/ p>

show显示指定设置的值。在您的情况下,它是version

➜  sbt-learning-space  sbt "show version"
[info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins
[info] Loading project definition from /Users/jacek/sandbox/sbt-learning-space/project
[info] Set current project to hello (in build file:/Users/jacek/sandbox/sbt-learning-space/)
[info] 0.1-SNAPSHOT

构建中的当前版本为0.1-SNAPSHOT。我们将1.0.0更改为set,并将给定的设置应用于当前项目。

➜  sbt-learning-space  sbt 'set version := "1.0.0"'
[info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins
[info] Loading project definition from /Users/jacek/sandbox/sbt-learning-space/project
[info] Set current project to hello (in build file:/Users/jacek/sandbox/sbt-learning-space/)
[info] Defining *:version
[info] The new value will be used by *:isSnapshot, *:projectId and 3 others.
[info]  Run `last` for details.
[info] Reapplying settings...
[info] Set current project to hello (in build file:/Users/jacek/sandbox/sbt-learning-space/)

它不会自动保留设置。

➜  sbt-learning-space  sbt "show version"
[info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins
[info] Loading project definition from /Users/jacek/sandbox/sbt-learning-space/project
[info] Set current project to hello (in build file:/Users/jacek/sandbox/sbt-learning-space/)
[info] 0.1-SNAPSHOT

您应该运行session savesession save-all,通过将会话设置写入.sbt配置文件来永久保持会话设置。

➜  sbt-learning-space  sbt 'set version := "1.0.0"' 'session save'
[info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins
[info] Loading project definition from /Users/jacek/sandbox/sbt-learning-space/project
[info] Set current project to hello (in build file:/Users/jacek/sandbox/sbt-learning-space/)
[info] Defining *:version
[info] The new value will be used by *:isSnapshot, *:projectId and 3 others.
[info]  Run `last` for details.
[info] Reapplying settings...
[info] Set current project to hello (in build file:/Users/jacek/sandbox/sbt-learning-space/)
[info] Reapplying settings...
[info] Set current project to hello (in build file:/Users/jacek/sandbox/sbt-learning-space/)

session save version的值已持久保存到build.sbt个文件。

➜  sbt-learning-space  sbt "show version"
[info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins
[info] Loading project definition from /Users/jacek/sandbox/sbt-learning-space/project
[info] Set current project to hello (in build file:/Users/jacek/sandbox/sbt-learning-space/)
[info] 1.0.0