Does Checkstyle task have to be classpath dependant?

(Marcin Zajączkowski) #1

Checkstyle tasks seem to be executed even if there are no changes in code in a given module. Looking at the --info report of the project build it seems that the problem is a classpath taken as an input parameter. However, AFAIK Checkstyle doesn’t take into account classpath dependencies - just the source files. For some modules checkstyle execution can easily take over a minute what can aggregate to several/dozen of minutes in large projects (which could be easily taken from cache).

Is there a reason why Checkstyle task has to be classpath dependent?

(Sterling Greene) #2

Some Checkstyle checks rely on the classpath. e.g., will try to locate classes referenced from @throws and complain if the exception type cannot be found.

If you knew you didn’t use any of those types of checks, I think you could override this configuration:

tasks.withType(Checkstyle) {
   classpath = files() 

(Marcin Zajączkowski) #3

Thanks Sterling, I haven’t used them (knowingly) before. I will give your workaround a try.