# How to disable build failures with enabled configuration cache in Gradle?

**URL:** <https://discuss.gradle.org/t/how-to-disable-build-failures-with-enabled-configuration-cache-in-gradle/45699>\
**Category:** Help/Discuss\
**Created:** [May 26, 2023, 1:45pm UTC](https://discuss.gradle.org/t/how-to-disable-build-failures-with-enabled-configuration-cache-in-gradle/45699 "2023-05-26T13:45:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![artemptushkin](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/artemptushkin/32/10509_2.png) [@artemptushkin](https://discuss.gradle.org/u/artemptushkin)\
**Post date:** [May 26, 2023, 1:45pm UTC](https://discuss.gradle.org/t/how-to-disable-build-failures-with-enabled-configuration-cache-in-gradle/45699/1 "2023-05-26T13:45:20Z")

</div>

I have:

gradle.properties

```plaintext
org.gradle.configuration-cache=true
org.gradle.configuration-cache.problems=warn

```

JIB plugin defined:

```plaintext
jib {
	container {
		creationTime.set("USE_CURRENT_TIMESTAMP")
		mainClass = "com.my.MyApp"
	}
	from {
		image = "eclipse-temurin:17-jre"
	}
}

```

I run:

```plaintext
./gradlew jibDockerBuild

```

I get:

```plaintext
> Task :jibDockerBuild FAILED

10 problems were found storing the configuration cache, 2 of which seem unique.
- Task `:jibDockerBuild` of type `com.google.cloud.tools.jib.gradle.BuildDockerTask`: cannot deserialize object of type 'org.gradle.api.Project' as these are not supported with the configuration cache.
  See https://docs.gradle.org/8.1.1/userguide/configuration_cache.html#config_cache:requirements:disallowed_types
- Task `:jibDockerBuild` of type `com.google.cloud.tools.jib.gradle.BuildDockerTask`: cannot serialize object of type 'org.gradle.api.internal.project.DefaultProject', a subtype of 'org.gradle.api.Project', as these are not supported with the configuration cache.
  See https://docs.gradle.org/8.1.1/userguide/configuration_cache.html#config_cache:requirements:disallowed_types

See the complete report at file:///Users/artemptushkin/gitlab/IptiQ/dx/spring-cloud-config-server/build/reports/configuration-cache/dmnth65ek47ehgnuriyy459yl/ac38wk6b6wvejhas26wg0jngi/configuration-cache-report.html

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':jibDockerBuild'.
> Cannot invoke "org.gradle.api.Project.getProjectDir()" because "this.project" is null

```

It passes away when I disable the configuration cache

My expectations are that if I set `org.gradle.configuration-cache.problems=warn` then it **never fails** though it does

Relevant issue in the plugin [Configuration cache problems in Gradle 8.1 · Issue #225 · n0mer/gradle-git-properties · GitHub](https://github.com/n0mer/gradle-git-properties/issues/225)

---

<div class="post-metadata">

**Author:** ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)\
**Post date:** [May 26, 2023, 1:54pm UTC](https://discuss.gradle.org/t/how-to-disable-build-failures-with-enabled-configuration-cache-in-gradle/45699/2 "2023-05-26T13:54:13Z")

</div>

Feels like a bug to me.  
Before Gradle 8, the task execution was done just normal from the actively built model in the run storing the configuration cache.  
Since 8.0 even in the run storing the cache, the state as deserialized from the configuration cache is used, to have a more consistent and defined behavior for example.

I believe that this changes causes your problem.  
It should probably use the built model and not the deserialized one if there are CC problems and the setting is to just warn.

You should definitely open a bug report about it and post its link here.

As a work-around you could try to declare that task as CC incompatible, maybe it works then.

If not, the only work-around would probably be to downgrade Gradle, or disable the CC.

---

<div class="post-metadata">

**Author:** ![artemptushkin](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/artemptushkin/32/10509_2.png) [@artemptushkin](https://discuss.gradle.org/u/artemptushkin)\
**Post date:** [May 31, 2023, 9:44am UTC](https://discuss.gradle.org/t/how-to-disable-build-failures-with-enabled-configuration-cache-in-gradle/45699/3 "2023-05-31T09:44:03Z")

</div>

Thanks, I opened a bug

---

<div class="post-metadata">

**Author:** ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)\
**Post date:** [May 31, 2023, 11:02am UTC](https://discuss.gradle.org/t/how-to-disable-build-failures-with-enabled-configuration-cache-in-gradle/45699/4 "2023-05-31T11:02:57Z")

</div>

Great, please post the link here, so anyone finding this thread can follow and thumbs-up.

---

<div class="post-metadata">

**Author:** ![artemptushkin](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/artemptushkin/32/10509_2.png) [@artemptushkin](https://discuss.gradle.org/u/artemptushkin)\
**Post date:** [June 2, 2023, 12:55pm UTC](https://discuss.gradle.org/t/how-to-disable-build-failures-with-enabled-configuration-cache-in-gradle/45699/5 "2023-06-02T12:55:15Z")

</div>

[Gradle build fails with configuration cache enabled with warnings · Issue #25235 · gradle/gradle · GitHub](https://github.com/gradle/gradle/issues/25235) the corresponded Gradle bug

@Vampire take a look into the bug, please @eskatos says it’s just a documentation issue

---

<div class="post-metadata">

**Author:** ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)\
**Post date:** [June 2, 2023, 2:27pm UTC](https://discuss.gradle.org/t/how-to-disable-build-failures-with-enabled-configuration-cache-in-gradle/45699/6 "2023-06-02T14:27:33Z")

</div>

Well, I’m just a user like you.  
If Paul considers this just a doc issue, that’s maybe the case.  
I added my voice to the issue, but ultimately the Gradle guys decide of course. 🙂
