I have a project consists of multiple sub projects, which are defined in the settings.gradle file.
Whenever I run a unit test of one of the projects, it always "configures" and compiles dependent modules again even though there is no changes on them.
This is really painful since it takes a while to finish it. I didn't have this problem before on the same project, but it suddenly appeared. Any ideas how to fix it? I use intellij for IDE and gradle for build. The output looks like this:
> Configure project :xx1
compiling YYYY
> Configure project :xx2
compiling YYYY
> Configure project :xx3
compiling YYYY
> Configure project :xx4
compiling YYYY
As you're probably aware, a task will only run if it's UP-TO-DATE
check fails. A task's UP-TO-DATE
check will
UP-TO-DATE
only if both current hashes match the previous hashesTry running gradle passing the -i
flag (or --info
) to see the results of the UP-TO-DATE
checking. I'm guessing a task has its inputs/outputs configured incorrectly causing an UP-TO-DATE
check to fail somewhere in your task tree. Perhaps you are using the current date/time somewhere as a task input? (don't do this!). Maybe two tasks are copying files to the same directory? (don't do this)
A good way to verify your build is to:
In a perfect world, the second build won't do any work. If the second build executes any tasks then it's likely there's some task inputs/outputs which are incorrectly configured