Version
version
命令显示现有的构建和 git 信息,方法是将其集成到 shell 应用程序(如果存在)的 Boot BuildProperties
和 GitProperties
中。默认情况下,只显示版本信息,您可以通过配置选项启用其他信息。
The version
command shows existing build and git info by integrating into
Boot’s BuildProperties
and GitProperties
if those exist in the shell application.
By default, only version information is shown, and you can enable other information through configuration
options.
相关设置位于 spring.shell.command.version
下,您可以在其中使用 enabled
禁用命令,并可以选择使用 template
定义您自己的模板。您可以使用 show-build-artifact
、show-build-group
、show-build-name
、show-build-time
、show-build-version
、show-git-branch
、show-git-commit-id
、show-git-short-commit-id
和 show-git-commit-time
命令来控制默认模板中的字段。
The relevant settings are under spring.shell.command.version
, where you can use enabled
to
disable a command and, optionally, define your own template with template
. You can use the
show-build-artifact
, show-build-group
, show-build-name
, show-build-time
,
show-build-version
, show-git-branch
, show-git-commit-id
,
show-git-short-commit-id
and show-git-commit-time
commands to control
fields in a default template.
该模板默认为 classpath:template/version-default.st
,您可以定义自己的模板,如下例所示:
The template defaults to classpath:template/version-default.st
, and you can define
your own, as the following example shows:
<buildVersion>
此设置将输出类似以下内容:
This setting would output something like the following:
X.X.X
您可以在默认模板呈现中添加以下属性:buildVersion
、buildGroup
、buildGroup
、buildName
、buildTime
、gitShortCommitId
、gitCommitId
、gitBranch
和 gitCommitTime
。
You can add the following attributes to the default template rendering: buildVersion
, buildGroup
,
buildGroup
, buildName
, buildTime
, gitShortCommitId
, gitCommitId
,
gitBranch
, and gitCommitTime
.