'how to disable gradle build scan permanently?
I know I can add --no-scan
on an individual command line (see https://docs.gradle.com/build-scan-plugin/), but I'm looking for a way to disable this in build.gradle
, gradle.properties
or settings.gradle
so i dont have to always type it or set an alias.
Any Ideas on how that can be done?
Solution 1:[1]
You can edit your hosts
file on your computer and place the entry where it is sending the reports to 127.0.0.1
. It will print some errors after every build, but that is all.
Another possibility is to add --no-scan
to gradle
command or wrapper script.
Solution 2:[2]
You can query gradle parameters (tasks, flags...etc.) through StartParameter and fail a build early if it runs with --scan
flag as reported by StartParameter.isBuildScan().
The release of Gradle is not specified in the question and that API is available since Gradle 3.1. I believe it was incubating until Gradle 5.X.
if (gradle.startParameter.isBuildScan()) {
throw new GradleException("you shall not scan")
}
Solution 3:[3]
Add this to your main build.gradle
file (groovy):
buildScan {
server = 'https://gradle-build-scan-disabled'
}
Now, any attempt to run a --scan
will result in an error.
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 | |
Solution 2 | |
Solution 3 | Michiel Haisma |