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!

0
12 comments

Hi.

Please check this answer:

https://stackoverflow.com/a/37002644/8958060

0
Avatar
Permanently deleted user

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:

0

Could you please provide a project example?

0
Avatar
Permanently deleted user

What is the best way to provide a project example? GitHub?

0

Github is fine.

0
Avatar
Permanently deleted user

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.

0

For output please check the first tab:

0
Avatar
Permanently deleted user

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).

0

It is possible to drag console window:

0
Avatar
Permanently deleted user

Thank you very much! :-)

0
Avatar
Permanently deleted user

Is it possible to have the Gradle console with the debug controls?

0

@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.

0

Please sign in to leave a comment.