spring-boot: bootRepackage's jar rewriting defeats Gradle's up-to-date checks, causing unnecessary rebuilds

bootRepackage overwrites build/libs/xxx.jar, keeping the original jar as build/libs/xxx.jar.original.

On the next build, Gradle will find that build/libs/xxx.jar has been changed compared to what the previous run’s jar task left, so it will assume that build/libs/xxx.jar needs to be regenerated.

Possible solutions that I can see:

  1. Don’t overwrite build/libs/xxx.jar, generate build/libs/xxx.boot.jar. (Please see #1112 for another issue that affects the naming code.)
  2. Modify Gradle’s jar task so that it generates the uber jar right off the bat.

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Reactions: 2
  • Comments: 26 (12 by maintainers)

Commits related to this issue

Most upvoted comments

@philwebb changing default behavior of my building system isn’t exactly what I expect from spring plugin. Thanks for the link.

@bademux I don’t think it’s “pure evil” or a “really bad decision” and comments like this on a issues that’s been closed a year aren’t really constructive. Have you tried reading this section of the documentation which describes how you can use a Spring Boot application as a dependency?