发布应用
原文:https://docs.spring.io/spring-boot/gradle-plugin/publishing.html (Spring Boot 4.2.0)
使用 maven-publish 插件发布
要发布 Spring Boot jar 或 war,可以使用 MavenPublication 的 artifact 方法将其添加到发布物中。传入产生所需 artifact 的任务。例如发布默认 bootJar 任务产生的 artifact:
publishing { publications { bootJava(MavenPublication) { artifact tasks.named("bootJar") } } repositories { maven { url = 'https://repo.example.com' } } }
使用 application 插件分发
当应用 application 插件时,会创建一个名为 boot 的分发。该分发包含 bootJar 或 bootWar 任务产生的归档以及在类 Unix 平台和 Windows 上启动它的脚本。zip 和 tar 分发可以分别通过 bootDistZip 和 bootDistTar 任务构建。要使用 application 插件,其 mainClassName 属性必须配置为应用主类的名称。