To reproduce:
I am using the latest IntelliJ IDEA, 2021.1, Community Edition. My Gradle settings inside IDEA:
Build and run using: Gradle
Run tests using: Gradle
Use Gradle from: ‘gradle-wrapper.properties’ file
Gradle JVM: 1.8 version 1.8.0_282
I create a new directory with the following build.gradle file:
gradle.taskGraph.whenReady {
throw new GradleException(“foo”)
}
and the following gradle/wrapper/gradle-wrapper.properties file:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-4.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
IntelliJ IDEA loads and syncs the project with no errors, with the message:
CONFIGURE SUCCESSFUL in 2s
(Although running any Gradle task will still produce an error.) However, when I change the Gradle version to 4.8 (or any higher version):
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-4.8-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
and then close the project, delete the .gradle and .idea directories, and reopen the project in IntelliJ IDEA, IntelliJ IDEA fails to sync, with the error:
Build file ‘/home/username/path_to_project/build.gradle’ line: 2
foo
My question is, what caused the change in behavior in syncing between Gradle versions 4.7 and 4.8? And what can I do to bring back the behavior where it successfully syncs even if build fails, on Gradle versions 4.8 and above?