Looks like scalastyle plugin is using absole paths for the scala source directories, which makes the tasks non cacheable across multiple checkouts of the same commit into multiple local directories.
Based on the comment on the superclass https://github.com/gradle/gradle/blob/v7.4.1/subprojects/core/src/main/java/org/gradle/api/tasks/SourceTask.java#L61 , I believe the fix is to override getSource method and annotate it with @PathSensitive(PathSensitivity.RELATIVE).
Gradle Enterprise reports this:

Looks like scalastyle plugin is using absole paths for the scala source directories, which makes the tasks non cacheable across multiple checkouts of the same commit into multiple local directories.
Based on the comment on the superclass https://github.com/gradle/gradle/blob/v7.4.1/subprojects/core/src/main/java/org/gradle/api/tasks/SourceTask.java#L61 , I believe the fix is to override
getSourcemethod and annotate it with@PathSensitive(PathSensitivity.RELATIVE).Gradle Enterprise reports this:
