How can I disable the GradleTaskWarmUpService when...
# intellij
h
How can I disable the GradleTaskWarmUpService when syncing a Kotlin gradle project? I have some Test tasks that need specific grade properties (secrets) that are not available locally, but IntelliJ always tries to warm-up the tasks by configuration them during sync.
t
Couldn't find a documented toggle specifically for
GradleTaskWarmUpService
— it's part of the mechanism that populates the Gradle task list/run configuration dropdown, so I wouldn't recommend disabling it even if a way existed. Better fix: instead of eagerly reading secrets in task configuration (
System.getenv(...)
/
project.findProperty(...)
directly), use the Provider API so it's evaluated lazily:
Copy code
tasks.test {
    environment("SECRET_KEY", providers.environmentVariable("SECRET_KEY").orElse(""))
}
This only gets evaluated at task execution time, not during sync/configuration, so the warm-up won't fail on missing secrets. If you need a quick workaround in the meantime: IntelliJ sets the system property
idea.sync.active=true
during sync, so you can guard the eager code:
Copy code
if (System.getProperty("idea.sync.active") != "true") {
    // secret-dependent config
}
h
Thats exactly what I do, but IntelliJ (as very often in the past) does wrongly configure the tasks eagerly:
Copy code
tasks.test {
    environment("SECRET_KEY", providers.environmentVariable("SECRET_KEY"))
}
I do want to not add a default value, because I need the value to be present when I run the task, but IntelliJ should not configure the task during sync.
t
You reported this: IDEA-377887 (youtrack.jetbrains.com/issue/IDEA-377887). Have you tried Roman's suggestion — reset IDE cache + Gradle User Home, then retest? Comment result on ticket, that reopens it.