Not sure if it is a proper place - can we have som...
# develocity
e
Not sure if it is a proper place - can we have somewhere compatibility table between develocity gradle plugin and develocity server?
g
Hi, Eugen 👋🏻 It's documented here
e
Thank you!
Oke, sorry for many messages. Can I make server upload rejection is fatal for build?
Copy code
Develocity plugin version 4.2.2 is newer than the newest version supported by Develocity 2025.2.1 which is 4.1. Please update to a newer version of Develocity.
And maybe not for the network error but for the plugin version misalignment
g
The behavior is to never fail the build for any of these features, so it's not supported out-of-the-box, but I can try to help you achieve it. There's a hidden callback you can use:
Copy code
develocity {
  buildScan {
    onError { jsonString ->
      // fail the build
    }
  }
}
onError is defined as
Copy code
/**
     * Registers a callback that is invoked when an error occurs capturing, spooling or publishing a build scan.
     * <p>
     * The callback receives a JSON document describing the error.
     *
     * @param action the action to execute when an error occurs, with a description of the error
     */
    void onError(Action<String> action);
You may try failing the build inside that callback, else if that's not possible, as a best effort, writing to a file and, in the subsequent build, failing if the file exists. If you also need this behavior in local builds, then you must account for the case of Failed background Build Scan uploads as well
e
I've tried to add onError in kotlin gradle script but sync fails
I probably need some smart import
g
Sorry, you'll have to cast it. The public API for
buildScan
only exposes our intended public features.
Copy code
import com.gradle.develocity.agent.gradle.internal.scan.BuildScanConfigurationWithHiddenFeatures

develocity {
  (buildScan as BuildScanConfigurationWithHiddenFeatures).apply {
    onError { 
      // ...
    }
  }
}
You may define a function to prettify it, of course. Then you can use a similar syntax as before from the build scripts.
Copy code
fun DevelocityConfiguration.buildScanWithHiddenFeatures(
  action: BuildScanConfigurationWithHiddenFeatures.() -> Unit,
) {
    (buildScan as BuildScanConfigurationWithHiddenFeatures).apply(action)
}
e
Thanks!
Oke I had hope to fail gradle if there is something
But that is not possible - the max I got gradle warning
g
Yes. Unfortunately, it's often too late to fail the build. The next best thing that is possible would be to fail the following build. We've noted it as a feature request, however 🙂
You may try failing the build inside that callback, else if that's not possible, as a best effort, writing to a file and, in the subsequent build, failing if the file exists.
If you also need this behavior in local builds, then you must account for the case of Failed background Build Scan uploads as well
e
Thanks!
Sure I can write own check after but would be great to have it all contained in gradle