Use 'getFiles()' on TaskOutputs directly

I want to include the one jar file that my build script creates, in a package. I get a deprecation warning about:

task 'dist'(type: Copy, dependsOn: [jar, 'dist-lib']) {
  from 'src/main/resources'
  from jar.outputs.files()
  into 'build/dist'
}

saying:

The chaining of the getFiles() method has been deprecated and is scheduled to be removed
in Gradle 4.0. Use 'getFiles()' on TaskOutputs directly instead.

How does one “use getFiles() on TaskOutputs directly”?

I think it means this:

task 'dist'(type: Copy, dependsOn: [jar, 'dist-lib']) {
  from 'src/main/resources'
  from jar
  into 'build/dist'
}

from jar instead of from jar.outputs.files().

Bonus; Using from jar creates an implicit task dependency so you no longer need to specify that the dist task depends on jar.