Stephan202 opened a new issue, #934: URL: https://github.com/apache/maven-enforcer/issues/934
### New feature, improvement proposal We have a large multi-module build with quite a number of built-in and [extra](https://github.com/mojohaus/extra-enforcer-rules) enforcer rules enabled. For modules with many dependencies, plugin execution takes several seconds, adding up to hundreds of seconds over-all. Based on some profiling, most time is spent repeatedly collecting dependency information: <img width="1835" height="735" alt="Image" src="https://github.com/user-attachments/assets/817eac46-4a30-45ed-ab3e-13c7cf8f3384" /> I had a brief look at the code, and besides [full rule caching](https://github.com/apache/maven-enforcer/blob/ee5abeeabba6acad11b3b5ba279def0ab6c1f80c/maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/internal/EnforcerRuleCache.java#L57) it appears that dependency resolution isn't cached. Would it be possible to add this, such that distinct rules applied to the same module can reuse invariant dependency information? --- I suppose that the changes in #930 could be extended to support more fine-grained caching ([`AbstractResolveDependencies#collectProjectDependencies()`](https://github.com/mojohaus/extra-enforcer-rules/blob/1faa3fec2f557c289339c6dd78ff945355a74e7d/src/main/java/org/codehaus/mojo/extraenforcer/dependencies/AbstractResolveDependencies.java#L92) would be an easy candidate), but [`SessionData`](https://maven.apache.org/resolver/apidocs/org/eclipse/aether/SessionData.html)'s documentation explicitly states: > Unlike a cache, this session data is not subject to purging. For this same reason, session data should also not be abused as a cache (i.e. for storing values that can be re-calculated) to avoid memory exhaustion. There's also [`EnforcerRuleHelper#getCache(String key, Supplier<?> producer)`](https://github.com/apache/maven-enforcer/blob/ee5abeeabba6acad11b3b5ba279def0ab6c1f80c/enforcer-api/src/main/java/org/apache/maven/enforcer/rule/api/EnforcerRuleHelper.java#L126), but `EnforcerRuleHelper` is deprecated. I can't promise to have time in the near feature to help implement any improvement in this area, but if one were to attempt this, what would be the recommended approach? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
