Gradle println does not show in TeamCity build log
Hi everyone,
I'm trying to send service messages to TeamCity from a gradle build, but the TeamCity build log does not show the messages gradle sends.
I added this line to the build.gradle file:
println "##teamcity[buildNumber \'${version}\']"
On my Windows PC, when I build, I get this log:
- - - - - - -
Evaluating root project 'myproject' using build file 'C:\dev\git\myproject\build.gradle'.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_5lsajsa3ggf65v6fydwbv18qj.run(C:\dev\git\myproject\build.gradle:28)
##teamcity[buildNumber '2.3.0-SNAPSHOT']
Uploading C:\dev\git\myproject\build\libs\myproject-2.3.0-SNAPSHOT.jar
- - - - - - -
However, on TeamCity I get this build log:
- - - - - - -
[18:15:21] : [Step 1/1] Evaluating root project 'myproject' using build file '/buildagent/work/70fa40ddc91a30ad/build.gradle'.
[18:15:21] : [Step 1/1] Compiling build file '/buildagent/work/70fa40ddc91a30ad/build.gradle' using SubsetScriptTransformer.
[18:15:22] : [Step 1/1] Compiling build file '/buildagent/work/70fa40ddc91a30ad/build.gradle' using BuildScriptTransformer.
[18:15:23] : [Step 1/1] The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
[18:15:23] : [Step 1/1] at build_11fef8fnozrqg6dibsa0uzq1k.run(/buildagent/work/70fa40ddc91a30ad/build.gradle:28)[18:15:25] : [Step 1/1] Uploading /buildagent/work/70fa40ddc91a30ad/build/libs/myproject-2.3.0-SNAPSHOT.jar
- - - - - -
We're using TeamCity Enterprise 10.0.3 (build 42434) and gradle wrapper 3.2
Anyone knows why TeamCity ignores Gradle messages?
Any help would be great! thanks, Eyal
Please sign in to leave a comment.
Hi Eyal,
I've just done a test run on 10.0.4 with wrapper 3.2, created a dummy task that simply has a doFirst{ println 'Hello' } block, and running it has printed the message successfully, although to see it in the build log web UI you need to click on a nested plus sign on the left. Could you try doing that, to see whether the issue is with the gradle runner on your side, or with your own script?
Could you check whether the build log files, or teamcity-agent.log contains some information around that time about possible issues?