title: Creating the fatJar task in doLast in gradle
body: <p>I have got one situation which needs fat jar task to created in doLast and copy the jar in one of the folder. For this, I have written the below task.</p>
  
  <p>task config{</p>
  
  <pre><code>doLast {
      clean 
  task createFatJar(type: Jar) {
  manifest {
      attributes 'Implementation-Title': 'myProjecrt Jar File',  
          'Implementation-Version': version,
          'Main-Class': 'com.bitwise.MyApplication'
  }
  baseName = project.name
  from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
  zip64 true
  with jar
  }
  //copy to deployment
  def inputdir = file("${buildDir}/libs/qualidi-0.0.1-SNAPSHOT.jar")
  def dest = file("C:\\MyFolder\\SubFolder")
  copy {
     from inputdir
      into dest
  }  
  }
  </code></pre>
  
  <p>}
  if i create the createFatJar task seprately and execute it it works fine,but in do last it creates the 1 kb file.</p>
  
  <p>Thanks in advance.</p>