网站seo设计,北京市建设投标网站,企业网站建设总体构架,福田网站-建设深圳信科我想拥有要发布新版本时自动更新的版本号#xff0c;因此我着手了解如何使用Play Framework进行此操作。 我发现我可以将其基于sbt-release插件#xff0c;但是并不是那么简单。 这是我的策略#xff0c;因此最后我要做的就是运行“ activator release ”#xff1a; 1.添… 我想拥有要发布新版本时自动更新的版本号因此我着手了解如何使用Play Framework进行此操作。 我发现我可以将其基于sbt-release插件但是并不是那么简单。 这是我的策略因此最后我要做的就是运行“ activator release ” 1.添加插件 通过project/plugins.sbt下行添加到您的project/plugins.sbt文件来添加插件 addSbtPlugin(com.github.gseitz % sbt-release % 1.0.2)2.更新您的build.sbt文件 在文件顶部附近添加此导入 import ReleaseTransformations._ 更改版本为 version : (version in ThisBuild).value 接下来可以选择在末尾添加这段代码并注释掉您不想执行的管道阶段注意这显然是默认管道 releaseProcess : Seq[ReleaseStep](checkSnapshotDependencies, // : ReleaseStepinquireVersions, // : ReleaseSteprunTest, // : ReleaseStepsetReleaseVersion, // : ReleaseStepcommitReleaseVersion, // : ReleaseStep, performs the initial git checkstagRelease, // : ReleaseStep//publishArtifacts, // : ReleaseStep, checks whether publishTo is properly set upsetNextVersion, // : ReleaseStepcommitNextVersion // : ReleaseStep//pushChanges // : ReleaseStep, also checks that an upstream branch is properly configured
) 注意我已经注释掉了自动发布和git push 3.在控制器中获取版本号并传递给模板 public static Result index() {String title Application.class.getPackage().getImplementationTitle(); String version Application.class.getPackage().getImplementationVersion(); return ok(index.render(version));
} 并将其显示在模板中 (version: String)...
Version: version4.发布前确保一切都已提交 5.执行发布 执行发行版后新版本将存储在文件files.sbt中 。 activator release 您可以在sbt-release插件中查找更多选项和可能性包括在此处自动增加版本的策略 https : //github.com/sbt/sbt-release 翻译自: https://www.javacodegeeks.com/2016/03/add-auto-update-version-number-play-framework-2-x-project.html