Spring Boot 2 - Change Jar Name

后端 未结 8 1729
耶瑟儿~
耶瑟儿~ 2021-02-06 23:29

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 G

8条回答
  •  北荒
    北荒 (楼主)
    2021-02-07 00:14

    My goal was to remove version from the archive name. I did it this way:

    bootJar {
       archiveName = "$baseName.$extension"
    }
    

    Now Gradle generates "project-name.jar" instead of "project-name-1.0-SNAPSHOT.jar". This solution is general and doesn't hardcode any particular archive name.

提交回复
热议问题