I have been having endless grief with Gradle for Android builds after I had to format my Macbook Pro for some stupid corporate domain migration. I have been using Gradle (both off the command line and with Android Studio) to build my projects for over an year now, and never had problems till the fresh install. I spent countless hours over the weekend trying to fix this, but with no luck, and I'm literally on the verge of tearing my hair out! Here is what I'm stuck with: 

Gradle builds have slowed to a crawl
====================================

I have a multi-project (or multi-module in Android terms) project which used to take around 2 minutes for a clean build - plus uploading archives to the (local) Maven repository. Now,the Gradle configuration phase takes around **8 minutes**! Nothing has changed, for after the fresh setup on the Mac, I just took a pull of the sources from the Github repo, and I'm building using the gradle wrapper (as before) which uses version `2.2.1`. Not sure if this matters, but the Gradle version on my machine is `2.6`. I use Maven - not for builds, but for the local M2 repository, and the Maven version is `3.3.3`. Both Maven and Gradle were installed using Homebrew. The Gradle runtimes are the same whether of the command line or using Android Studio. I'm using Android Studio version `1.4-beta4`. Here are the things I have set up: 

* I have set up the Maven `settings.xml` to point the local Maven repository to the default location `${user.home}/.m2/repository
* I have set up Google repository using Android Studio and the Support repository (my project needs Play services and the support library)
* We need to upload the archives to the corporate Maven repository on our build servers; to sidestep this, I use the `gradle.properties` to define the repository URL to be the local M2 repository that's set up in the Maven settings
* The project defines Android build tools version `1.1.0`, and while this is an older version, I tried with the latest `1.3.1` with no luck on the build times
* Possibly related: my Mac Pro uses a good ol' HDD, not the newer solid-state storage. While that can impact build times, the disk was not updated during the format, and also, I presume that it shouldn't result in such multiple orders of magnitude impact

Failure in resolving artifacts from local M2 repo
=================================================

The primary project that I work on is a library, and we have test clients that we use to verify functionality. The library and test clients are maintained as separate projects in the Github repo. To not have to make *any* changes in my local development setup, I prefer to deploy the artifacts from my library to my local M2 repo, and then have the test client define and resolve the dependency locally. I accomplish this using the global `gradle.properties` to override the repository URL (point it to the local M2 repo). This worked just fine till the disk format, but is broken since. Gradle is never able to resolve the artifacts, but I can see them in the local M2 repo. I have googled high and low (on Gradle forums, here on SO), but cannot seem to figure out what I'm missing or doing wrongly. As a work-around, I added the test client as a module to the library project, and am building it as a single multi-module project. BTW, even with this, I still run into the slow Gradle build times problem that I mentioned above. 

Can someone help me out?