此版本仍在开发中,尚未被视为稳定版本。对于最新的稳定版本,请使用 Spring Boot 3.4.0! |
发布应用程序
使用 Maven-publish 插件发布
要发布 Spring Boot jar 或 war,请使用artifact
method 开启MavenPublication
.
将生成要发布到的工件的任务传递给artifact
方法。
例如,要发布默认bootJar
任务:
-
Groovy
-
Kotlin
publishing {
publications {
bootJava(MavenPublication) {
artifact tasks.named("bootJar")
}
}
repositories {
maven {
url 'https://repo.example.com'
}
}
}
publishing {
publications {
create<MavenPublication>("bootJava") {
artifact(tasks.named("bootJar"))
}
}
repositories {
maven {
url = uri("https://repo.example.com")
}
}
}
使用 Application Plugin 进行分发
当application
插件将应用一个名为boot
已创建。
此分发包含由bootJar
或bootWar
任务和脚本来启动它。
Zip 和 tar 发行版可以通过bootDistZip
和bootDistTar
任务。
要使用application
plugin 的mainClassName
属性必须配置应用程序的主类的名称。