对于最新的稳定版本,请使用 Spring Boot 3.5.5! |
发布您的应用程序
使用 Maven-publish 插件发布
要发布 Spring Boot jar 或 war,请使用artifact
方法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
插件应用名为boot
创建。此发行版包含由bootJar
或bootWar
任务和脚本,以便在类 Unix 平台和 Windows 上启动它。Zip 和 tar 发行版可以通过bootDistZip
和bootDistTar
任务。要使用application
plugin,其mainClassName
属性必须配置为应用程序主类的名称。