JDK: 21.0.7+6 (Adoptium)
Gradle: 8.9 (included with Eclipse 2025-03 with latest updates) and 8.14
OS: Windows 11 (AV exclusion enabled for entire D: drive where eclipse, JDK, and gradle resides)
When I enable the war plugin for one of my subprojects, I get this error below:
Could not execute build using connection to Gradle installation 'D:\Dev\gradle\gradle-8.14'.
Configuration cache problems found in this build.
1 problem was found storing the configuration cache.
- Task `:erm_war:eclipseWtpComponent` of type `org.gradle.plugins.ide.eclipse.GenerateEclipseWtpComponent`: 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.14/userguide/configuration_cache.html#config_cache:requirements:disallowed_types
See the complete report at file:///D:/Dev/_projects_/java/erm/build/reports/configuration-cache/20y5eo1eqi4qrdmt6xj5i2c8u/8lsk9nbs6vmw2j4qpsw7o1g4z/configuration-cache-report.html
I tried deleting both eclipse, gradle, and project caches without success. Please help.
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java library project to get you started.
* For more details on building Java & JVM projects, please refer to https://docs.gradle.org/8.9/userguide/building_java_projects.html in the Gradle documentation.
*/
plugins {
// Apply the java-library plugin for API and implementation separation.
`java-library`
`war`
}
repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}
dependencies {
// Use JUnit Jupiter for testing.
testImplementation(libs.junit.jupiter)
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
// This dependency is exported to consumers, that is to say found on their compile classpath.
api(libs.commons.math3)
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation(libs.guava)
}
// Apply a specific Java toolchain to ease working on different environments.
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
tasks.named<Test>("test") {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}
In the midst of troubleshooting, I recreated several test projects to find root cause. Sometimes the gradle.properties file is created in the root project directory with configuration-cache enabled. How do I ensure that file is created or not when creating a new project?
I also stumble on something else I don’t know if it’s related to the cache but when I change the project’s facet configuration (either through GUI or manually editing the XML file), the facets changed from:
How do I ensure that file is created or not when creating a new project?
Depends on how you create those projects I guess.
If you for example use the init task, it might maybe depend on the concrete options / answers you use, what content is generated.
It seems I’m not the only one having problems with facet changing on gradle refreshes
That things that are coming from the Gradle import are overwritten on Gradle import is normal and expected.
But you can use your buildscript to change the value to your liking, then you also don’t need to change it in the UI after import every time.
For example with this buildscript snippet in Kotlin DSL and the eclipse-wtp plugin applied, you can make 6.0 to be used:
eclipse {
wtp {
facet {
facet(
"type" to installed,
"name" to "jst.web",
"version" to "6.0"
)
file {
whenMerged {
this as WtpFacet
facets.removeIf { (it.type == installed) && (it.name == "jst.web") && (it.version != "6.0") }
}
}
}
}
}