title: Gradle uploadArchives task doesn't respect custom versioning scheme when generating pom file
body: <p>I have a gradle plugin to implement a custom versioning scheme, nearly identical to the suggestion in section 49.8.2.2 of the gradle docs. Company projects using gradle apply the plugin and then declare dependencies as suggested: compile 'group:name:{default}' where {default} is a string that indicates that the actual version should be supplied by the plugin. The plugin replaces {default} with the correct version at configuration time as determined by the logic in the plugin. This all works great.</p>
  
  <p>The problem is that when I run the uploadArchives task, which uses the mavenDeployer, the resulting dependencies in the generated pom file get a version of {default}, i.e. the indicator string rather than the actual dependency version. When our maven projects try to pull in this pom as a dependency they are unable to resolve it's dependencies.</p>
  
  <p>Looking around the web and messing with it myself, it appears that when running the uploadArchives task, gradle first dumps all of the other built up configuration. So even though the project configuration was built up by the plugin with correct dependency versions during the configuration phase, the configuration with those versions is not used by the uploadArchives task when generating the pom file.</p>
  
  <p>How do I get the uploadArchives task to generate the pom file using the dependency versions resolved at configuration time by the custom version plugin?</p>
  
  <p>Here is my build.gradle file:  </p>
  
  <pre><code>buildscript {
      repositories {
          maven {url "somewhere/overtherainbow/releases/"}
      }
      dependencies {
          classpath 'com.overtherainbow:custom-dependency-resolution-plugin:1.0-SNAPSHOT'
      }
  }
  
  subprojects {
  
      apply plugin: 'custom-dependency-resolution'
      apply plugin: 'java'
      apply plugin: 'maven'
  
      group = "com.overtherainbow"
      version ="1.0-SNAPSHOT"
  
      repositories {
          maven {url "somewhere/overtherainbow/releases/"}
          mavenCentral()
      }
  
      dependencies {
          compile 'javax.servlet:servlet-api:default'
          compile 'log4j:log4j:default'
      }
  
      uploadArchives {
          repositories {
              mavenDeployer {
                  uniqueVersion = false
                  repository(url: "somewhere/overtherainbow/releases) 
                  snapshotRepository(url: "somewhere/overtherainbow/snapshots")
              }
          }
      }
  }
  
  project(':bar') {
      dependencies {
          compile project(':common')
          compile project(':foo')
      }
  }
  
  project(':foo') {
      dependencies {
          compile project(':common')
      }
  }
  </code></pre>
  
  <p>Here is the plugin code:</p>
  
  <pre><code>package com.overtherainbow
  
  import org.gradle.api.Project
  import org.gradle.api.Plugin
  import org.gradle.api.artifacts.DependencyResolveDetails
  
  class DefaultVersionPlugin implements Plugin&lt;Project&gt; {
      // This is where dependency versions are defined
      def defaultVersionsMap = [
          'javax.servlet:servlet-api' : '2.5',
          'log4j:log4j' : '1.2.16']
  
      void apply(Project project) {
          project.configurations.all {
              resolutionStrategy.eachDependency {
                  DependencyResolveDetails details -&gt; resolveDependencyVersion(project, details)
              }
          }
      }
  
      def resolveDependencyVersion(Project project, DependencyResolveDetails details) {
          if (details.requested.version == 'default') {
              def version = resolveDefaultVersion(project, details.requested.group, details.requested.name)
              details.useVersion version
          }
      }
  
      def resolveDefaultVersion(Project project, String group, String name) {
          project.logger.debug("Resolving default dependency for $group:$name")
          println "Resolving default dependency for $group:$name"
          defaultVersionsMap["$group:$name"]
      }
  }
  </code></pre>
  
  <p>And the output of running uploadArchives, notice that the plugin runs during the first task (compileJava) for each project but not for uploadArchives:</p>
  
  <pre><code>$ gradle uploadArchives
  :common:compileJava
  Resolving default dependency for javax.servlet:servlet-api
  Resolving default dependency for log4j:log4j
  :common:compileJava UP-TO-DATE
  :common:processResources UP-TO-DATE
  :common:classes UP-TO-DATE
  :common:jar UP-TO-DATE
  :foo:compileJava
  Resolving default dependency for javax.servlet:servlet-api
  Resolving default dependency for log4j:log4j
  :foo:compileJava UP-TO-DATE
  :foo:processResources UP-TO-DATE
  :foo:classes UP-TO-DATE
  :foo:jar UP-TO-DATE
  :bar:compileJava
  Resolving default dependency for javax.servlet:servlet-api
  Resolving default dependency for log4j:log4j
  :bar:compileJava UP-TO-DATE
  :bar:processResources UP-TO-DATE
  :bar:classes UP-TO-DATE
  :bar:jar UP-TO-DATE
  :bar:uploadArchives
  Uploading: com/overtherainbow/bar/1.0-SNAPSHOT/bar-1.0-SNAPSHOT.jar to...
  Transferring 19K from remote
  Uploaded 19K
  :common:uploadArchives
  Uploading: com/overtherainbow/common/1.0-SNAPSHOT/common-1.0-SNAPSHOT.jar to...
  Transferring 5K from remote
  Uploaded 5K
  :foo:uploadArchives
  Uploading: com/overtherainbow/foo/1.0-SNAPSHOT/foo-1.0-SNAPSHOT.jar to...
  Transferring 15K from remote
  Uploaded 15K
  </code></pre>
  
  <p>And here is a look at the dependencies section of the generated pom file, note the versions set to default:</p>
  
  <pre><code>&lt;dependencies&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
      &lt;artifactId&gt;servlet-api&lt;/artifactId&gt;
      &lt;version&gt;default&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;log4j&lt;/groupId&gt;
      &lt;artifactId&gt;log4j&lt;/artifactId&gt;
      &lt;version&gt;default&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
    &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>