Skip to content

Due to gradle/gradle#5510, compileJava may be executed unnecessarily when not using Gradle's daemon #14054

@display-none

Description

@display-none

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:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions