Besides the obvious point, that you should better not use Gradle internal classes, it works just fine here.
Maybe you just don’t see it because you immediately pass through that code and after the progress is finished it is no longer be displayed.
If I copy your code and add a ´Thread.sleep(5000)` between the lines, I see the progress reported as expected.
Thanks for your answer @Vampire.
I was able to see the progress while running my gradle task via the command line.
So, glad to know it works.
I am using Jetbrains IntelliJ IDEA as my IDE.
Strange thing is that, the progress I see in the command line is not seen in the IDE’s console when I run the task from IDE.