Pom + archivesBaseName + multiple publish locations = bug

This is related to GRADLE-443. If I have a project with archivesBaseName that is publishing a pom file, the depending projects’ pom files correctly get rewritten unless we’re publishing to multiple locations.

Top-level build.gradle:

apply plugin: 'java'
apply plugin: 'maven'
allprojects { p ->
    p.group = "com.example"
    p.afterEvaluate {
        uploadArchives.repositories {
            flatDir {
                dirs "$rootDir/dist"
            }
            mavenDeployer {
                repository(url: "file:///$rootDir/deploy")
            }
        }
    }
}

Top-level settings.gradle:

include 'a', 'b'

a/build.gradle:

apply plugin: 'java'
apply plugin: 'maven'
dependencies {
    compile project(':b')
}

b/build.gradle:

apply plugin: 'java'
apply plugin: 'maven'
archivesBaseName = 'b-special'

Run “gradle uploadArchives” and then look at deploy/com/example/a/unspecified/a-unspecified.pom. Then comment out the flatDir publish in the top-level build.gradle and run it again. The pom will be different (correct) the second time.