gradle: tar task not creating a tar.gz

Hi I have a tar task that I made after looking at numerous methods and some SO posts.

task buildDist(type: Tar, dependsOn: jar) {
  print 'here'
  archiveName = 'xyz-' + version
  destinationDir = file('build/dist')
  extension = 'tar.gz'
  compression = Compression.GZIP

  from 'build/libs'
  include 'xyz.jar'

I have the java plugin applied and the jar task makes the xyz.jar file available under build/libs . The build/dist directory does not exist yet, but I tried new File("build/dist") as well. That did not work either - I even pointed it to the build directory that exists - doesn’t work. I run the entire script with /gradlew clean build . The print in the above code does print.