Skip to content

Limit config property scanning to mapped classes for configuration cache stability#53006

Open
cdsap wants to merge 2 commits intoquarkusio:mainfrom
cdsap:iv/fix-gradle-config-cache-sys-props
Open

Limit config property scanning to mapped classes for configuration cache stability#53006
cdsap wants to merge 2 commits intoquarkusio:mainfrom
cdsap:iv/fix-gradle-config-cache-sys-props

Conversation

@cdsap
Copy link
Contributor

@cdsap cdsap commented Mar 10, 2026

Based on the PR comments on this PR #52507, this PR implements:

  • Added a new getCachingValues() method in EffectiveConfig that only looks up properties from PackageConfig and NativeConfig mappings (the known, relevant properties), avoiding the full getPropertyNames() scan.
  • Made getValues() and getQuarkusValues() lazy so they're only computed during task execution, not during configuration.
  • Refactored BaseConfig.cachingRelevantProperties() to use the new caching-safe values and directly include matching environment variables in the result map (instead of just reading them for side-effect tracking).

@radcortez @aloubyansky

@quarkus-bot quarkus-bot bot added area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/gradle Gradle labels Mar 10, 2026
@quarkus-bot

This comment has been minimized.

return unmodifiableMap(properties);
}
});
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@radcortez could you please review this code? Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update:

When I tested yesterday, I realized I was hitting the configuration cache after changing the system properties. However, after restarting the Gradle process, I noticed that the problem persisted.

The problem is that making EffectiveConfig values lazy doesn’t help because EffectiveConfig builder is still called. Under the hood it invokes ConfigUtils.emptyConfigBuilder().addSystemSources(), which triggers addDefaultSources() → System.getProperties(), registering every system property as an input regardless of caching.

With the new EffectiveConfig commit, when it is called during the configuration phase, we now use a minimal SmallRyeConfigBuilder (bypassing addDefaultSources()) and inject only the pre-filtered properties at their correct ordinals.
Removing addDefaultSources() means SmallRye no longer has access to JVM system properties like java.home and user.home. However, Quarkus config defaults reference these in

  • NativeConfig.javaHome() defaults to ${java.home}
  • PackageConfig.DecompilerConfig.jarDirectory() defaults to ${user.home}/.quarkus.
    So that's why I'm adding
private static final List<String> JVM_PROPERTIES_FOR_CONFIG_EXPANSION = List.of(
            "java.home", "user.home");

to track those system properties. Please, let me know if needs to be expanded.

This new commit also covers the system property change test and clean up the system property usage.

Please review again.

@quarkus-bot
Copy link

quarkus-bot bot commented Mar 12, 2026

Status for workflow Quarkus CI

This is the status report for running Quarkus CI on commit f7bd55b.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

You can consult the Develocity build scans.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/gradle Gradle

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants