Hi,
It is strange. I use the same versions as you and for me it works.
I created a new gradle kotlin dsl project with the gradle 4.2.1 install on my system, and this project also works like a charm. the command i ran was
gradle run
You can clone is from https://github.com/jtonic/gradledsl
If this project doesn’t work for you as well I recommend to Invalidate and Restart project. I hope this will help you.
Kr
Tony