The above approach works perfectly fine when its used for a single module project. However, for a multi-module gradle project, the above approach throws the following error:
A problem occurred configuring root project 'universal-thrift-proxy'.
> Could not find property 'java' on SoftwareComponentInternal set.
We do not want to expose this script to the rest of the org (we do not want ppl to be uploading artifacts to central repo from their machines than the build farm); hence we are not using an "apply from" mechanic which works fine.