Capture build scans on ge.apache.org to benefit from deep build insights (#5411)

diff --git a/settings.gradle b/settings.gradle
index 9c9cca5..2dd08df 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -16,14 +16,36 @@
  */
 
 plugins {
-    id "com.gradle.enterprise" version "3.10.2"
+    id 'com.gradle.enterprise' version '3.13.2'
+    id 'com.gradle.common-custom-user-data-gradle-plugin' version '1.10'
 }
 
+def isGithubActions = System.getenv('GITHUB_ACTIONS') != null
+def isJenkins = System.getenv('JENKINS_URL') != null
+def isCI = isGithubActions || isJenkins
+
 gradleEnterprise {
+    server = "https://ge.apache.org"
     buildScan {
-        termsOfServiceUrl = 'https://gradle.com/terms-of-service'
-        termsOfServiceAgree = 'yes'
-        publishAlwaysIf(System.getenv('CI') != null)
+        capture { taskInputFiles = true }
+        uploadInBackground = !isCI
+        publishAlways()
+        publishIfAuthenticated()
+        obfuscation {
+            // This obfuscates the IP addresses of the build machine in the build scan.
+            // Alternatively, the build scan will provide the hostname for troubleshooting host-specific issues.
+            ipAddresses { addresses -> addresses.collect { address -> "0.0.0.0"} }
+        }
+    }
+}
+
+buildCache {
+    local {
+        enabled = !isCI
+    }
+
+    remote(gradleEnterprise.buildCache) {
+        enabled = false
     }
 }