cowwoc opened a new pull request, #424:
URL: https://github.com/apache/maven-build-cache-extension/pull/424

   ## Summary
   
   When running with `-Dmaven.build.cache.enabled=false`, the build fails with:
   ```
   IllegalStateException: Cache is not initialized. Actual state: DISABLED
   ```
   
   This occurs because `stagePreExistingArtifacts()` was being called 
unconditionally, which internally calls `collectCachedArtifactPaths()`, which 
then calls `cacheConfig.getAttachedOutputs()`. The `getAttachedOutputs()` 
method calls `checkInitializedState()` which throws when the cache state is 
DISABLED.
   
   ## Fix
   
   Add a check for `cacheState == INITIALIZED` before calling 
`stagePreExistingArtifacts()` and `restoreStagedArtifacts()`, ensuring these 
cache-dependent operations are only performed when the cache is properly 
initialized.
   
   ## Test plan
   
   - [x] Build compiles successfully
   - [ ] Run existing tests to verify no regressions
   - [ ] Manual test: run `mvn clean install -Dmaven.build.cache.enabled=false` 
on a project with the extension - should no longer fail
   
   Fixes the regression reported in 
https://github.com/apache/maven-build-cache-extension/pull/394#issuecomment-3714680789


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