Very similar to https://github.com/spring-projects/spring-boot/issues/8308
That's an old issue however and details such as the name of the task and how exactly it is configured in build.gradle
has changed. So rather than re-opening that issue I figured its probably better just to treat it as a new issue.
To reproduce:
- create a new gradle boot project using intializr wizard. Select starters web, 'actuator' and devtools (actuator is probably not needed). All other settings leave at default (so using boot version
2.3.1
at the time of this writing). - edit 'build.gradle' and add this:
bootJar {
excludeDevtools = false
}
Build a jar:
./gradlew build
Expectation:
- the jar should contain devtools
Realtity:
- the jar doesn't contain devtools.
To verify this we looked for devtools dependency in the jar like so:
$ jar tf build/libs/gradle-paddle-0.0.1-SNAPSHOT.jar | grep dev
The bug also affects docker image build, which is were we discovered it, while trying to implement 'devtools integration' for STS with STS docker support.
This bug is a blocker for us as it means implementing devtools integration for gradle-based docker deployment of a boot project is not possible at the moment (which means we will only be (able to) supporting it for maven project for the time being).
Somewhat related to this. I wonder if it would be possible to allow controlling this option via a commandline parameter as well? E.g. most convenient for us would be that it obeys the same system property that the maven plugin obeys, so that basically we can make devtools be included into a build by adding -Dspring-boot.repackage.excludeDevtools=false
on the build command for maven and gradle in the exact same way. Slightly less convenient would be another system property or command-line parameter, the most inconvenient would be that it requires the ide to make an actual change in the user's build.gradle
file on disk. (I can raise this as a separate issue, just wanted to get a sense on whether it sounds reasonable to you first).
Comment From: wilkinsona
Duplicates #22533.