The Gradle scripts have grown fairly complicated over time as things are just layered over previous layers over previous layers over ...
Also we have quite a few work-arounds related to thing that have been resolved in Gradle over the intervening years.
Ideally look at a clean-room approach here
This is tentatively scheduled for Beta1
Here is a list of duscussions I have started on the Gradle forums related to this issue and trying to re-work aspects of the scipts: