title: Gradle maven-publish plugin doesn't allow to setup version
body: <p>I need help with publishing an artifact using 'maven-publish' plugin. I use it since my next step is to publish several artifact for projects and 'maven' plugin hardly usable for that case. So please don't suggest to use it. The problem that if I use variable to setup version then gradle fails with error. It works fine if I specify fixed value however If I use variable It doesn't work. How I can pass version from variable to the publication?</p>
  
  <p>Related code:</p>
  
  <pre><code>println "project.version = $project.version"
  ext.artifactVersion = String.valueOf(project.version);
  
  println "artifactVersion = $artifactVersion" // to check that value is correct
  
  publishing {
      publications {
          //publishArtifact(project)  
          maven(MavenPublication) {
              groupId project.group
              artifactId project.ext.artifactId
  
              println artifactVersion
              String artifactVersion2 = artifactVersion
              //version "1248"             // works
              //version artifactVersion    // doesn't work 
              //version "$artifactVersion" // doesn't work
              //version ''+artifactVersion // doesn't work
              //version '1248'             // works
              //version
              version "${artifactVersion}" // doesn't work 
              from project.components.java
          } 
      }
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>project.version = 1248
  artifactVersion = 1248
  1248
  :prj:generatePomFileForMavenPublication
  :prj:compileJava UP-TO-DATE
  :prj:processResources UP-TO-DATE
  :prj:classes UP-TO-DATE
  :prj:jar UP-TO-DATE
  :prj:publishMavenPublicationToMavenLocal FAILED
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Execution failed for task ':prj:publishMavenPublicationToMavenLocal'.
  &gt; Failed to publish publication 'maven' to repository 'MavenLocal'
      &gt; Invalid publication 'maven': supplied version does not match POM file (cannot edit version directly in the POM file).
  </code></pre>