reda-alaoui opened a new issue, #579:
URL: https://github.com/apache/maven-build-cache-extension/issues/579

   ### Affected version
   
   1.3.0
   
   ### Bug description
   
   Changing a `<dependencyManagement>` version of a dependency the project only 
gets transitively doesn't invalidate the cache. The next build is restored from 
cache, even though Maven now resolves a different version of that dependency.
   
   **Impact.** Plugins that check the dependency graph are skipped and their 
old result is restored. For us that's `maven-enforcer-plugin` with 
`RequireUpperBoundDeps`. Automated dependency updates (Renovate) that changed 
only a managed version got a cache hit for `enforcer:enforce`. They passed CI 
and were merged, although an uncached build fails the rule. This happened 
twice, with `jakarta.xml.bind-api` and with `xml-apis`. The failure then 
surfaced on later, unrelated changes that happened to miss the cache. That left 
master silently broken and made those authors chase a failure they didn't cause.
   
   **Reproducer.** A project depending on `junit:junit:4.13.2`, which brings 
`org.hamcrest:hamcrest-core:1.3` transitively:
   
   1. Add:
      ```xml
      <dependencyManagement>
        <dependencies>
          <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-core</artifactId>
            <version>1.3</version>
          </dependency>
        </dependencies>
      </dependencyManagement>
      ```
   2. `mvn verify`: the build is saved to the cache.
   3. Change the managed version to `1.2`.
   4. `mvn verify`: the build is restored from cache (`Found cached build`).
   
   **Expected:** step 4 misses the cache, because the build now uses 
`hamcrest-core:1.2`. Changing the managed version of a dependency the project 
doesn't use at all should still give a cache hit.
   
   **Related:** #407 reports the same kind of miss for transitive snapshot 
dependencies.
   


-- 
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]

Reply via email to