Brice Dutheil
09/10/2025, 12:41 PM--scan condition, the following code fails
develocity {
buildScan {
termsOfUseUrl.set("<https://gradle.com/help/legal-terms-of-use>")
termsOfUseAgree.set("yes")
publishing {
onlyIf {
(System.getenv("CI") != null) or gradle.startParameter.isBuildScan
}
}
}
}
with a serialization issue
1 problem was found storing the configuration cache.
- Gradle runtime: cannot serialize object of type 'org.gradle.initialization.DefaultSettings', a subtype of 'org.gradle.api.initialization.Settings', as these are not supported with the configuration cache.
See <https://docs.gradle.org/9.0.0/userguide/configuration_cache_requirements.html#config_cache:requirements:disallowed_types>
Maybe you have more ideas on this ?Brice Dutheil
09/10/2025, 12:49 PMdevelocity block, declaring startParameter within develocity seem to fix the serialization issue.Philip W
09/10/2025, 12:55 PMPhilip W
09/10/2025, 12:59 PM--scan to upload a BuildScan:
val isCI = providers.environmentVariable("CI").isPresent
publishing {
onlyIf { isCI }
}
But it is basically our codeBrice Dutheil
09/10/2025, 2:08 PMVampire
09/10/2025, 2:10 PMBrice Dutheil
09/10/2025, 2:12 PMVampire
09/10/2025, 2:12 PMVampire
09/10/2025, 2:12 PMBrice Dutheil
09/10/2025, 2:14 PMBrice Dutheil
09/10/2025, 2:15 PMVampire
09/10/2025, 2:15 PMVampire
09/10/2025, 2:15 PMVampire
09/10/2025, 2:16 PMidea.sync.active system property in the onlyIfVampire
09/10/2025, 2:17 PMonlyIf { true } and also configuring the ToS agreeing in the build script which is a very bad idea. πBrice Dutheil
09/10/2025, 2:21 PMtermsOfUseAgree.set("yes")Vampire
09/10/2025, 2:37 PMVampire
09/10/2025, 2:38 PMidea.sync.active should not be checked in the onlyIf for a FOSS project.
Otherwise I just open your project in my IDE and suddenly my personal data was uploaded to Gradle servers without my consent.Vampire
09/10/2025, 2:39 PMBrice Dutheil
09/10/2025, 2:40 PMVampire
09/10/2025, 3:10 PMVampire
09/10/2025, 3:26 PMimport com.gradle.develocity.agent.gradle.DevelocityConfiguration
initscript {
repositories {
gradlePluginPortal()
}
dependencies {
classpath("com.gradle.develocity:com.gradle.develocity.gradle.plugin:+")
}
}
settingsEvaluated {
pluginManager.withPlugin("com.gradle.develocity") {
configure<DevelocityConfiguration> {
buildScan {
termsOfUseAgree.convention(termsOfUseUrl.map { if (it == "<https://gradle.com/help/legal-terms-of-use>") "yes" else null })
}
}
}
}Pratikshit singh
09/12/2025, 5:38 AMVampire
09/12/2025, 7:39 AMPratikshit singh
09/15/2025, 7:55 AMBrice Dutheil
09/16/2025, 10:40 PMextensions.configure<com.gradle.develocity.agent.gradle.DevelocityConfiguration>() {}
It outputs the following
org.gradle.api.UnknownDomainObjectException: Extension of type 'DevelocityConfiguration' does not exist. Currently registered extension types: [ExtraPropertiesExtension, DevelocityConfiguration]
Tried with
extensions.configure<com.gradle.develocity.agent.gradle.DevelocityConfiguration>("develocity") { }
fails with
class com.gradle.develocity.agent.gradle.internal.a_Decorated cannot be cast to class com.gradle.develocity.agent.gradle.DevelocityConfiguration (com.gradle.develocity.agent.gradle.internal.a_Decorated is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader$InstrumentingVisitableURLClassLoader @75a61f4; com.gradle.develocity.agent.gradle.DevelocityConfiguration is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader$InstrumentingVisitableURLClassLoader @5c22aa46)
And without surprise this return null
extensions.findByType<com.gradle.develocity.agent.gradle.DevelocityConfiguration>()?Vampire
09/17/2025, 6:51 AMVampire
09/17/2025, 6:56 AMsettingsEvaluated {
pluginManager.withPlugin("com.gradle.develocity") {
develocity {
buildScan {
termsOfUseAgree.convention(termsOfUseUrl.map { (it == '<https://gradle.com/help/legal-terms-of-use|https://gradle.com/help/legal-terms-of-use>') ? 'yes' : null })
}
}
}
}
as complete init scriptVampire
09/17/2025, 6:57 AMBrice Dutheil
09/17/2025, 9:21 AMorg.gradle.toolchains.foojay-resolver-convention plugin id, that is appearing in my project's settings.pluginManager to it in groovy, otherwise the lookup happens on the Gradle object. Also, withPlugin gives an AppliedPlugin, so it's necessary to prefix by settings as well.
settingsEvaluated { settings->
logger.lifecycle('settings evaluated')
settings.pluginManager.withPlugin('com.gradle.develocity') {
logger.lifecycle('Develocity applied')
settings.develocity.buildScan {
logger.lifecycle('auto accepting terms')
termsOfUseAgree.convention(termsOfUseUrl.map { (it == '<https://gradle.com/help/legal-terms-of-use>') ? 'yes' : null })
}
}
}Brice Dutheil
09/17/2025, 10:46 AMwithGroovyBuilder
initscript {
repositories {
gradlePluginPortal()
}
dependencies {
classpath("com.gradle.develocity:com.gradle.develocity.gradle.plugin:+")
}
}
settingsEvaluated {
pluginManager.withPlugin("com.gradle.develocity") {
extensions["develocity"].withGroovyBuilder {
configureBuildScan(getProperty("buildScan"))
}
}
}
fun configureBuildScan(extension: Any) {
extension.withGroovyBuilder {
@Suppress("UNCHECKED_CAST")
(getProperty("termsOfUseAgree") as Property<String>).convention((getProperty("termsOfUseUrl") as Property<String>).map {
if (it == "<https://gradle.com/help/legal-terms-of-use>") "yes" else ""
})
}
}Brice Dutheil
09/17/2025, 10:48 AMclass com.gradle.develocity.agent.gradle.internal.a_Decorated cannot be cast to class com.gradle.develocity.agent.gradle.DevelocityConfiguration (com.gradle.develocity.agent.gradle.internal.a_Decorated is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader$InstrumentingVisitableURLClassLoader @75a61f4; com.gradle.develocity.agent.gradle.DevelocityConfiguration is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader$InstrumentingVisitableURLClassLoader @5c22aa46)Vampire
09/17/2025, 10:57 AMwithGroovyBuilder but as most of the script is in Groovy anyway, I'd just use a Groovy init script. π
The initscript block you can still leave out, then there is also no potential classloading issueVampire
09/17/2025, 10:57 AMinitscript you would only need if you need the classes within the script which you no longer useBrice Dutheil
09/17/2025, 11:05 AMPratikshit singh
09/23/2025, 5:19 AMBrice Dutheil
09/23/2025, 7:19 PMVampire
09/23/2025, 9:18 PMPratikshit singh
09/24/2025, 4:11 AM