-
Notifications
You must be signed in to change notification settings - Fork 41.4k
Description
spring-boot-gradle-plugin applied to a project build with no-daemon Gradle breaks incremental build - causes a retriggering of compileJava
with every run
Steps to reproduce:
- Check out https://github.com/spring-guides/gs-spring-boot
- run
gradlew --no-daemon clean assemble
- run
gradlew --no-daemon testClasses
Expected behaviour
Task compileJava
is UP-TO-DATE as nothing has changed that should trigger recompilation.
Actual behaviour
Task compileJava
is run because, as Gradle prints, "Task ':compileJava' has additional actions that have changed"
Probable cause
During up-to-date checks Gradle compares task's previously known actions with current actions for equality (see org.gradle.api.internal.changedetection.rules.TaskTypeTaskStateChanges
). Spring boot's org.springframework.boot.gradle.plugin.JavaPluginAction
configures a JavaCompile task in configureAdditionalMetadataLocations
with an action using a labda.
When building with a daemon that configuration probably happens once and in JavaCompile task's actions we can see the same lambda instance, which makes it equal and up-to-date check passes. When executing without a daemon another run has a different lambda instance and it fails the equality check.
In our project we have multiple steps configured as separate gradle runs and each of them recompiles the whole project.
Versions
Gradle 4.9
Spring Boot 2.0.4.RELEASE