title: How to set project.version by passing version property on gradle command line?
body: <p>I want to build JAR with self-defined version passed via command line, such as:</p>
  
  <p>When I execute gradle build task like this:</p>
  
  <pre><code>gradle build -Pversion=1.0
  </code></pre>
  
  <p>myproject-1.0.jar should be generated. </p>
  
  <p>I have tried adding the line below to the <strong><em>build.gradle</em></strong>, but it did not work:</p>
  
  <pre><code>version = project.hasProperty('version') ? project['version'] : '10.0.0'
  </code></pre>