Reputation: 772
I want to create a fat jar
using gradle
only with name, not include a version of the project.
I am using gradle 5.1
and spring boot 2.1.1
.
I have tried the following solutions with no luck
https://stackoverflow.com/a/31407245/8123983
Default jar name project-0.0.1-SNAPSHOT.jar
Expected jar name project-xyz.jar
Upvotes: 6
Views: 4227
Reputation: 133
On an example of Spring Boot 2.4+ && Gradle 6+, modify build.gradle:
plugins {
id 'org.springframework.boot' version '2.4.0.RELEASE'
}
bootJar {
archiveFileName = 'flawless-application.jar'
}
without boot plugin
jar {
archiveFileName = 'flawless-application.jar'
}
More docs here:
Upvotes: 2
Reputation: 772
I found the solution, finally!
jar {
archivesBaseName="project-name"
project.version=""
}
I have also tried with version
instead of project.version
. But, it's not working anymore in gradle 5.1 as it is deprecated as per the documentation.
archivesBaseName
changes only the prefix name, not remove the version from the jar name.
Upvotes: 10