Gradle build avoidance and fat jars

I haven’t tested this myself, but I’ve been reading and hearing about some of the build avoidance techniques, and there’s one thing I’m wondering about, with respect to things like “fat jars”.

It appears that if nothing changes in the task inputs except for the implementation of a dependent artifact (not the api), then Gradle will not recompile the source files that depend on that artifact.

Because of that, other tasks that depend on the class files will not run because the class files have not changed. In many cases, that is perfectly fine.

However, what about tasks like building a “fat jar”? Will that produce a new output if the implementation of a dependent artifact changes (again, not the api), and nothing else changes?

Compilation avoidance only applies to compilation, not packaging. If the class files that go into a fat jar change, the jar needs to be recreated.