我在我的 Gradle 项目中使用 Spring Boot 2 在 Jenkins 中构建 jar,我想更改该 jar 文件的名称。
默认情况下,Spring Boot 2 使用 Gradle 属性rootProject.name
,可以在/settings.gradle
文件中设置。
但是,我想更改 jar 文件名,而不更改rootProject.name
.
这是文件的我bootJar
和springBoot
部分build.gradle
:
bootJar {
launchScript()
}
.
springBoot {
buildInfo {
properties {
artifact = "jarName"
group = "groupName"
name = "projectName"
version = "1.0"
}
}
}
注意: artifact
没有像我预期的那样设置 jar 名称,阅读后:https ://docs.spring.io/spring-boot/docs/current/gradle-plugin/reference/html/#integrating-with-actuator