GradleSettings.getInstance(project) throws 'java.lang.IllegalStateException' exception

When I run the following code, I end up with the exception during unit tests. It works fine in production code.


The error is the following:

"@NotNull method org/jetbrains/plugins/gradle/settings/GradleSettings.getInstance must not return null"


How can I fix this, so it doesn't crash during tests?

Comment actions Permalink

Zaman, can you provide more details about your setup? Could you share a minimal reproducible project?

Comment actions Permalink

Jakub Chrzanowski, Unfortunately, it will take a while for me to make a minimal reproducible project.

I am currently using gradle.jar  from “{IntelliJ installation dir}/plugins/gradle/lib/gradle.jar” 2018.1.8 and `GradleSettings.getInstance(project)` works in production. Does this depend on other JARs which I need to include as well? 


Please sign in to leave a comment.