[Gradle] runIde starts IDE twice - due to subproject
Hi all,
I run into this somewhat inconvenient phenomenon. When launch the test IDE with the Gradle runIde task it starts as expected. But after exiting the test IDE the Gradle build picks up again and start another test IDE. That instance does not seem have my plugin at all.
My Gradle file is fairly basic. I only have one subproject used to create a seperate jps plugin. From the output (below) this seems to be the cause. A second runIde is invoked for the 'jps-plugin' subproject. I'm inexperienced when it comes to Gradle. Is there a way to avoid invoking the runIde task for the subproject? Or is this not the Gradle way and I should restructure my build?
Best regards,
Johan
dependencies {
compile(project("jps-plugin"))
}
Output Gradle:
Starting Gradle Daemon...
Gradle Daemon started in 738 ms
> Task :jps-plugin:compileKotlin UP-TO-DATE
> Task :jps-plugin:compileJava NO-SOURCE
> Task :jps-plugin:patchPluginXml NO-SOURCE
> Task :jps-plugin:processResources UP-TO-DATE
> Task :jps-plugin:classes UP-TO-DATE
> Task :jps-plugin:inspectClassesForKotlinIC UP-TO-DATE
> Task :jps-plugin:instrumentCode UP-TO-DATE
> Task :jps-plugin:postInstrumentCode
> Task :jps-plugin:jar UP-TO-DATE
> Task :compileKotlin UP-TO-DATE
> Task :compileJava NO-SOURCE
> Task :patchPluginXml UP-TO-DATE
> Task :processResources UP-TO-DATE
> Task :classes UP-TO-DATE
> Task :inspectClassesForKotlinIC UP-TO-DATE
> Task :instrumentCode UP-TO-DATE
> Task :postInstrumentCode
> Task :jar UP-TO-DATE
> Task :prepareSandbox UP-TO-DATE
> Task :runIde
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.intellij.util.ReflectionUtil to field sun.awt.X11.XToolkit.awtAppClassName
WARNING: Please consider reporting this to the maintainers of com.intellij.util.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
> Task :jps-plugin:prepareSandbox UP-TO-DATE
> Task :jps-plugin:runIde
Please sign in to leave a comment.
If you just specify the task name (e.g. runIde), gradle will run that task on all subprojects that support it (in your case, :runIde and :jps-plugin:runIde). You can use the :path1:path2:...:task syntax to only run one, with :task for the top-level task. That is, the following should only run the IDE once:
Instead of a subProject you can use a sibling-project, such that both projects aren't nested and therefore you don't have nested invocations.
you can compile your library with "includeBuild" in settings.gradle: https://docs.gradle.org/current/samples/sample_composite_builds_basics.html
Thank you very much for these pointers guys. I had restructured my project layout. Problem gone.
Cheers,
Johan