Create jar with fix name excluding version using gradle

Viewed 2831
2 Answers

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:

  1. https://docs.gradle.org/current/dsl/org.gradle.api.Project.html
  2. https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html#org.gradle.api.tasks.bundling.Jar:archiveFileName
  3. https://docs.spring.io/spring-boot/docs/current/gradle-plugin/reference/htmlsingle/#packaging-executable
Related