I am using Spring Boot 2 in my Gradle project to do a build to jar in Jenkins, and I would like to change the name of that jar file.
By default, Spring Boot 2 used the Gradle property rootProject.name
, which can be set in the /settings.gradle
file.
However, I would like to change the jar file name, without changing the rootProject.name
.
Here are my bootJar
and springBoot
sections of the build.gradle
file:
bootJar {
launchScript()
}
.
springBoot {
buildInfo {
properties {
artifact = "jarName"
group = "groupName"
name = "projectName"
version = "1.0"
}
}
}
Note: artifact
is not setting the jar name, as I expected it to, after reading: https://docs.spring.io/spring-boot/docs/current/gradle-plugin/reference/html/#integrating-with-actuator
artifact
build info property is, by default, derived from the base name of thebootJar
orbootWar
task not the other way around. If you configure it explicitly, the base name-based default will no longer be used and the explicit value will be used instead. The base name of thebootJar
orbootWar
task will be unaffected. – TaeguspringBoot.buildInfo.properties.artifact
and addingbootJar.baseName
worked! – Gasper