Yes, it is possible to use task.cacheIf { ... }
to determine when to enable caching for the Jar
task. Beware that some features (like renaming files, or eachFile {}
) are not tracked as inputs as of Gradle 4.0, so changing them will not result in a different cache key.