Dynamic version specifier '+' used verbatim in generated pom

Expected When publishing a maven artifact, dynamic version specifier ‘+’ for dependencies is replaced with actual latest version of the dependency in the generated Maven pom

Actual The generated pom of the published artifact leaves ‘+’ as the version specifier, which is not valid Maven syntax

Reproduce

// build.gradle
apply plugin: 'java'
apply plugin: 'maven'
  repositories {
    jcenter()
}
  dependencies {
    compile 'commons-io:commons-io:+'
}
  group = 'foo'
  uploadArchives {
    repositories {
        mavenDeployer {
            repository(url: "file:///tmp/testRepo/")
            pom.artifactId = 'bar'
            pom.version
  = '1.2.3'
        }
    }
}
$ /opt/gradle-2.2.1/bin/gradle uploadArchives --debug --refresh-dependencies
...
Downloaded artifact 'commons-io.jar (commons-io:commons-io:2.4)' from resolver: BintrayJCenter
...
$ cat /tmp/testRepo/foo/bar/1.2.3/bar-1.2.3.pom
...
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>+</version>
# incorrect/invalid maven version specifier
      <scope>compile</scope>
    </dependency>
...

Addendum

$ gradle -v
------------------------------------------------------------
Gradle 2.2.1
------------------------------------------------------------
  Build time:
 2014-11-24 09:45:35 UTC
Build number: none
Revision:
   6fcb59c06f43a4e6b1bcb401f7686a8601a1fb4a
  Groovy:
     2.3.6
Ant:
        Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM:
        1.7.0_65 (Oracle Corporation 24.65-b04)
OS:
         Linux 3.2.0-4-amd64 amd64

Created issue GRADLE-3224.

In case it helps others this is how I’m working around the issue for now:

mavenDeployer {
    pom.whenConfigured { p ->
        // get all unresolved dependencies in the pom
        def unresolved = p.getDependencies()
                          .grep { it.version == '+' }
          for (u in unresolved) {
            def artifact =
                "${u.groupId}:${u.artifactId}:${u.version}"
              // crawl each configuration and try to find a resolution
            // result for the unresolved artifact
            def resolved
            for ( c in project.configurations) {
                def deps = c.incoming
                            .getResolutionResult()
                            .getAllDependencies()
                  // a matching resolution result will have a requested
                // artifact name identical to the unresolved artifact
                resolved =
                    deps.grep { "${it.getRequested()}" == artifact }
                        .getAt(0)
                  if (resolved) {
                    break
                }
            }
              if (resolved) {
                // now replace the unresolved version with the
                // version selected by the resolution result
                u.version = resolved.getSelected()
                                    .getModuleVersion()
                                    .getVersion()
            }
        }
    }
}