title: Gradle extend task / Create task based on task
body: <p>New to Groovy, gradle. I want to extend the following task (part of java plugin):</p>
  
  <pre><code>jar {
      from { configurations.runtime.collect { zipTree(it) } }
  
      manifest.attributes( 'Implementation-Title': archivesBaseName,
                  'Implementation-Version': version,
                  'Main-Class': mainClassName,
                  'Built-By': POM_DEVELOPER_NAME
      )
  }
  </code></pre>
  
  <p>The extended task will have </p>
  
  <pre><code>archiveName = 'PJ-latest.jar'
  destinationDir = project.getRootDir()
  </code></pre>
  
  <p>In typical Java I would have called <code>super</code> but I'm not sure how I can do it in gradle. My best try is to extend the <code>Jar</code> class add the same parameters as <code>jar</code> has and also the dependencies:</p>
  
  <pre><code>task assembleCompiler(type: Jar){
      dependsOn compileJava, processResources, classes
  
      archiveName = 'PJ-latest.jar'
      destinationDir = project.getRootDir()
  
      from { configurations.runtime.collect { zipTree(it) } }
  
      manifest.attributes( 'Implementation-Title': archivesBaseName,
              'Implementation-Version': version,
              'Main-Class': mainClassName,
              'Built-By': POM_DEVELOPER_NAME
      )
  }
  </code></pre>