title: How to write Gradle build currentVersion to a file
body: <p>I am trying to do following steps:</p>
  
  <p>I have a <code>build.gradle</code> file configured for my project.   I want to execute the currentVersion task for my project to get the current version that the build generated and then save it to a text file.   I wil
  l run this build using jenkins and use that text file to get the version number to download the correct artifact from Nexus Repository.</p>
  
  <p>I feel either of the below ways can help me achieve this:</p>
  
  <ol>
  <li>Is there a way to run only the currentVersion task for my project through Jenkins and store the result in a text file ?</li>
  <li>Is there a way to run the currentVersion task through my build script and write the output to a text file ?</li>
  </ol>