I am going to answer my own question here. The problem was it was not able to find Gradle and hence failed when Jenkins issued gradle clean build
. The solution was to install a Gradle plugin through Jenkins > Manage Jenkins > Configure System > Gradle Installations
Once a Gradle installation is available then select that installation by going to the configuration page of your project. Build again and it should work.