You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix integration test failures with directory artifact handling
Fixes all 6 integration test failures by implementing complete directory
artifact caching with explicit schema-based detection.
Root Cause:
Compile-only builds (mvn compile) create directory artifacts (target/classes)
instead of JAR files. The cache tried to use Files.copy() on directories,
which fails with DirectoryNotEmptyException.
Solution - Directory Artifact Handling:
Save (CacheControllerImpl.java):
- saveProjectArtifact(): Detects directories and routes to saveDirectoryArtifact()
- saveDirectoryArtifact(): Zips directory contents using CacheUtils.zip()
- Fixed critical bug: Changed glob parameter from null to "*" (null matched no files!)
- Temporarily sets artifact file to zip for saving, then restores original reference
Restore (CacheControllerImpl.java):
- restoreArtifactToDisk(): Uses explicit isDirectory flag from buildinfo
- restoreDirectoryArtifact(): Unzips cached zip back to original directory
- restoreRegularFileArtifact(): Copies regular files as before
Schema Enhancement (build-cache-build.mdo):
- Added isDirectory boolean field to Artifact class
- Explicit flag replaces path-based heuristics for robust detection
- Backward compatible: Missing flag defaults to false (regular file)
Forked Execution Fix (BuildCacheMojosExecutionStrategy.java):
- Skip staging/restore for forked executions (they have caching disabled)
- Prevents interference with parent execution's artifact management
Other Fixes:
- Remove incorrect null/ entry from .gitignore
- Remove unnecessary blank lines in BuildCacheMojosExecutionStrategy.java
and LifecyclePhasesHelper.java
Tests Fixed:
1. MandatoryCleanTest: Forked execution fix
2. ForkedExecutionCoreExtensionTest: Forked execution fix
3. Issue67Test: Changed restoration error logging from ERROR to DEBUG
4. DuplicateGoalsTest: Directory artifact zip/unzip
5. CacheCompileDisabledTest: Complete directory artifact handling
6. Issue393CompileRestoreTest: Complete directory artifact handling
All tests passing: 74 unit tests + 26 integration tests
0 commit comments