The gradle plugin automatically extends your build script DSL with a
springBoot element for global configuration of the Boot plugin. Set
the appropriate properties as you would with any other Gradle
extension (see below for a list of configuration options):
在下面有一个配置bootRepackage插件的mainClass元素的例子:
The main class that should be run. If not specified, and you
have applied the application plugin, the mainClassName project
property will be used. If the application plugin has not been
applied or no mainClassName has been specified, the archive will
be searched for a suitable class. "Suitable" means a unique class
with a well-formed main() method (if more than one is found the
build will fail). If you have applied the application plugin,
the main class can also be specified via its "run" task
(main property) and/or its "startScripts" task
(mainClassName property) as an alternative to using the
"springBoot" configuration.
2 回答
在Gradle术语中,
springBoot
是一个扩展名 . 当您使用它来配置主类时,您将为项目中的每个重新打包任务配置它 . 另一方面,bootRepackage
正在引用单个重新打包任务,因此您只需为该一个任务配置mainClass
.如果您只有一个重新包装任务(默认情况下),这是个人偏好的问题 .
如果您已配置其他重新打包任务,则可能更好地在每个单独的任务上配置它而不是使用
springBoot
扩展 . 如果使用两者的混合,则单个重新打包任务的设置将优先于使用springBoot
配置的任何设置 .这是来自springBoot插件的文档:
在下面有一个配置bootRepackage插件的mainClass元素的例子:
换句话说,这两个是相同的 .