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.

GradleSettings.getInstance(project);


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?

0
2 comments

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

0

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? 

0

Please sign in to leave a comment.