Gradlew downloads distributes to current directory rather than PROJECT

I am using gradlew under windows. The wrapper task looks like this.

task wrapper (type: Wrapper) {
    distributionUrl = "file:///d:/path/to/gradle-1.12-bin.zip"
      archiveBase = "PROJECT"
    archivePath = "gradle/download"
      distributionBase = "PROJECT"
    distributionPath = "gradle"
      gradleVersion = "1.12"
}

When running gradlew (gradlew anyTask) for the first time gradle is downloaded and distributed to PROJECT directory.

However if I run from another directory (build\gradlew -p build anyTask) the download and distribution is taking place in the current directory rather than “build”.

Furthermore if I omit ‘-p build’ the task is not found at all even gradlew examines the APP_HOME directory correctly.