Is it possible to "copy" the configuration of a task of a given type into another task of the same type?

I’d like to create a “task fatJar(type: Jar)” that begins by getting configured exactly like the default “jar” task from the java plugin (i.e. same task dependencies, same artifact naming conventions, etc…), and then modify what’s included in the jar using the “from” method. I can manually configure the fatJar task in its entirety, but I’d prefer to inherit from or delegate to the configuration of jar.

Related to this, is there a way to say “run the build task, but instead of running jar, run fatJar”.

Thanks!

Is it possible to “copy” the configuration of a task of a given type into another task of the same type?

You’ll have to manually copy those parts of the configuration that you want to have copied.

Related to this, is there a way to say “run the build task, but instead of running jar, run fatJar”.

No, there isn’t.