JetBrains/gradle-idea-ext-plugin

Unable to launch beforeRun task using default projectPath in GradleTask

DmPanov opened this issue · 1 comments

Versions

org.jetbrains.gradle.plugin.idea-ext 0.2
IntelliJ IDEA 2018.3 EAP (Ultimate Edition)
Build #IU-183.156, built on June 19, 2018
JRE: 1.8.0_152-release-1282-b2 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.5

Steps to reproduce

configure idea plugin as follows:

task example {
    doFirst {
        println 'EXAMPLE'
    }
}

idea {
    project {
        settings {
            runConfigurations {
                'App'(Application) {
                    ...
                    beforeRun {
                        'beforeApp'(GradleTask) {
                            task = example
                        }
                    }
                }
            }
        }
    }
}

Problems

With default projectPath : App fails with following error:

The newly created daemon process has a different context than expected.
It won't be possible to reconnect to this daemon. Context mismatch: 
Java home is different.
...

Problem is gone when Gradle project for example selected manually in Before launch menu.
Resulting run configuration in xml:

...
<!--works-->
<option name="Gradle.BeforeRunTask" enabled="true" tasks="example" externalProjectPath="$PROJECT_DIR$" />
<!--fails-->
<option name="Gradle.BeforeRunTask" enabled="true" tasks="example" externalProjectPath=":" />
...

fixed in v0.4.1