Console output while debugging with a Gradle task?
Answered
Hi!
My IntelliJ IDEA project with Kotlin has output on console with println. When I use "Debug" with a Gradle task selected and step with the debugger, the output does not appear until the program is finished. If I use the IDEs run configuration to start main with "Debug", the output appears while stepping with the debugger. Is it possible to get console output while debugging with a Gradle task?
IntelliJ IDEA 2018.2.1 EAP (Community Edition)
Build #IC-182.3911.6, built on July 26, 2018
JRE: 1.8.0_152-release-1248-b8 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
Gradle 4.8.1 used with Gradle Kotlin Script
Kotlin 1.2.51
Thanks in advance!
Please sign in to leave a comment.
Hi.
Please check this answer:
https://stackoverflow.com/a/37002644/8958060
Hi Petr,
thanks, but that seems to be a different issue. I have a breakpoint in my code, that is reached, but the println output up to it is not shown anywhere.
My Debug-Tool-Window looks like this:
Could you please provide a project example?
What is the best way to provide a project example? GitHub?
Github is fine.
I pushed a project to https://github.com/NJM-Goals/IntelliJ_debugger_test_with_GradleKts
If you now set a breakpoint at println in main.kt and use Gradle's run task with the Debug button and then step the program, there will be no output on Console from the println.
For output please check the first tab:
Thank you very much! There it is! :-)
But is there a way to show the output and step with the debugger at the same time? As soon as I click on the first tab, the debugger buttons get greyed out (also in your screenshot).
It is possible to drag console window:
Thank you very much! :-)
Is it possible to have the Gradle console with the debug controls?
@Wallson
For now it is not possible, however, we are working on the solution for that.
Here is a related issue on YouTrack:
https://youtrack.jetbrains.com/issue/IDEA-200694
Feel free to watch it in order to be notified once it has updates. See [this article](https://intellij-support.jetbrains.com/hc/articles/207241135) if you are not familiar with YouTrack.