JavaExec delegation for using Gradle build cache

Viewed 66

I need an external Java converter tool which convert my A folder's files to a set of files in a B folder :

A --java-converter-tool--> B

Actually I call the java-converter-tool with a JavaExec task, but it's always run, and I want to use Gradle cache to detect changes in A folder as an input.

I understand the Gradle cache mechanism but JavaExec tasks are not overridable. The Gradle documentation says :

When possible, it is better to use delegation instead of creating a subclass. That is the case for the built in JavaExec, Exec, Copy and Sync tasks, which have a method on Project to do the actual work.

https://docs.gradle.org/current/userguide/build_cache.html

What I need is an example of delegation with JavaExec.

0 Answers
Related