reda-alaoui commented on PR #534: URL: https://github.com/apache/maven-build-cache-extension/pull/534#issuecomment-6810196292
@olamy, a related case that bears on your two comments here (the cost of collecting the graph, and filtering out test-scope dependencies). We hit a second blind spot of the same kind, unrelated to snapshots. A change in a `<dependencyManagement>` version that only applies to a transitive dependency leaves the project checksum unchanged: - The normalized effective pom keeps the declared dependencies and drops `<dependencyManagement>`. - Direct dependencies do pick up their managed version, so changing one of those is detected. - A managed version that only steers a transitive dependency never reaches the checksum. What happened to us: a dependency-update bot bumped a managed version (a `jakarta.xml.bind-api` bump, and in another project an `xml-apis` downgrade where the jar content is identical). The checksum stayed the same, so `enforcer:enforce` with `RequireUpperBoundDeps` was restored from cache, and the change merged green on a broken dependency graph. The breakage only showed up later, on unrelated changes that didn't hit the cache. Hashing the whole `<dependencyManagement>` block is too broad: `CacheInvalidationProjectTraitsTest#bomManagedUnusedDepVersionChangeDoesNotInvalidate` rightly expects an unused BOM entry not to invalidate anything. What has to be hashed is the version Maven actually picks for each dependency in the graph. That is the same graph collection #534 adds, which is why I'm raising it here. On your two points: - **Cost.** Collecting the graph only reads POMs, most of them already in the local repository; it doesn't need to download any jar. I agree it's extra work on cache hits, where Maven would otherwise skip dependency resolution. I haven't measured it on a large reactor yet. - **Test scope.** For this case it can't be filtered out. The enforcer (and any other plugin that reads the graph) checks every scope, so a version change in a test-scope dependency must invalidate a cached result that depends on it. Would you accept the resolved versions being recorded as part of the effective pom entry, along the lines AlexanderAshitkin suggested? Or would you rather have this tracked as its own issue so #534 stays focused on snapshots? I'm happy to open the issue with a reproducer, an integration test on the p01 reference project. -- 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]
