'How do I suppress 'Execution optimizations have been disabled' warnings in Gradle 7?
After upgrading to Gradle 7 I have many warnings like:
Execution optimizations have been disabled for task ':<...>:compileJava' to ensure correctness due to the following reasons:
- Gradle detected a problem with the following location: '<...>\build\classes\main'. Reason: Task ':<...>:compileJava' uses this output of task ':<...>:processResources' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
The cause: I redirect output of resources to the same folder as class files - for integration tests reading resources:
sourceSets {
main {
output.resourcesDir = file("build/classes/main")
java.outputDir = file("build/classes/main")
}
test {
output.resourcesDir = file("build/classes/test")
java.outputDir = file("build/classes/test")
}
}
How do I suppress those warnings?
Solution 1:[1]
I didn't find a way of how to suppress specific warnings, like lets say deprecation warnings only.
I am skipping those warnings with -q flag for the command line. Just to be aware that in this case all the warnings will be suppressed.
Example: gradlew build -q
At least you should create tasks to get rid of this technical debt. But then in the meantime you could use -q flag for your builds to avoid this additional noise. After the issues are resolved you remove -q flag.
Note that I also tried to use --warning-mode none flag which didn't work for deprecation warning.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | RenatoIvancic |
