Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to disable gradle build scan permanently?

Tags:

java

gradle

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?

like image 423
radai Avatar asked Sep 17 '19 21:09

radai


2 Answers

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.

like image 159
swist Avatar answered Nov 08 '22 15:11

swist


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")
}
like image 41
Jerome Avatar answered Nov 08 '22 16:11

Jerome