Since last year there's a new Gradle API for registering tasks called the 'Configuration Avoidance API'. This API was incubating from Gradle 4.9 to Gradle 5.1 inclusively, but since 5.0 has been quite stable.

This API basically lets us defined tasks configuration lazily so that they are configured only if needed. While a tasks.create("myEagerTask") would always launch myEagerTask configuration, a tasks.register("myLazyTask) would configure it only if necessary. For instance launching the simple ./gradlew help would configure myEagerTask even though they are not related, but will not configure myLazyTask. Similarly, launching ./gradlew myLazyTask will configure myLazyTask and myEagerTask.

The Spring Boot Gradle plugin configures all tasks eagerly. Their configurations does not take too much time (a ./gradlew help --scan shows they are configured in 0.04sec), but little by little, by using other plugins that aren't using this new API, we end up with several unnecessary tasks configured eagerly. It is also worth noting that the create API will one day be deprecated.

In regards to the recent issue https://github.com/spring-projects/spring-boot/issues/18777 using this recent API might be a step towards a brighter future.

Comment From: wilkinsona

Thanks for the suggestion, @celcius112. It seems reasonable to me. As you suggest, we can investigate this alongside #18777.