JetBrains/gradle-idea-ext-plugin

Cannot invoke method settings() on null object

sschuberth opened this issue · 2 comments

In a Kotlin project, I'm trying out the example with IntelliJ 2018.3, but on Gradle sync I'm getting Cannot invoke method settings() on null object. Any idea why idea.project is null? I also tried wrapping it in afterEvaluate without any luck.

Nevermind, the issue was that I was applying the plugin in the sub-project where I needed the task to be run. After applying the plugin in the root project and doing only the afterSync in the sub-project everything works.

FYI, I found a workaround. This will configure subprojects in a multi-project setup to use Intellij as the test runner instead of Gradle.

if(idea.project) {
	idea.project.settings {
		delegateActions {
			delegateBuildRunToGradle = true
			testRunner = org.jetbrains.gradle.ext.ActionDelegationConfig.TestRunner.PLATFORM
		}
	}
}