Commit aa6ab4f
committed
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 tests1 parent a421356 commit aa6ab4f
File tree
5 files changed
+99
-11
lines changed- src/main
- java/org/apache/maven/buildcache
- mdo
5 files changed
+99
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
| 151 | + | |
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
| 155 | + | |
155 | 156 | | |
156 | 157 | | |
157 | 158 | | |
158 | 159 | | |
159 | 160 | | |
160 | 161 | | |
| 162 | + | |
161 | 163 | | |
| 164 | + | |
162 | 165 | | |
163 | 166 | | |
164 | 167 | | |
| |||
185 | 188 | | |
186 | 189 | | |
187 | 190 | | |
188 | | - | |
| 191 | + | |
| 192 | + | |
189 | 193 | | |
190 | 194 | | |
191 | 195 | | |
| |||
266 | 270 | | |
267 | 271 | | |
268 | 272 | | |
269 | | - | |
270 | 273 | | |
271 | 274 | | |
272 | 275 | | |
| |||
Lines changed: 87 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
340 | 340 | | |
341 | 341 | | |
342 | 342 | | |
343 | | - | |
344 | | - | |
| 343 | + | |
345 | 344 | | |
346 | 345 | | |
347 | 346 | | |
348 | 347 | | |
349 | | - | |
350 | 348 | | |
351 | 349 | | |
352 | 350 | | |
| |||
355 | 353 | | |
356 | 354 | | |
357 | 355 | | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
358 | 391 | | |
359 | 392 | | |
360 | 393 | | |
| |||
448 | 481 | | |
449 | 482 | | |
450 | 483 | | |
451 | | - | |
| 484 | + | |
452 | 485 | | |
453 | 486 | | |
454 | 487 | | |
| |||
595 | 628 | | |
596 | 629 | | |
597 | 630 | | |
598 | | - | |
| 631 | + | |
599 | 632 | | |
600 | | - | |
| 633 | + | |
601 | 634 | | |
602 | 635 | | |
603 | 636 | | |
| |||
637 | 670 | | |
638 | 671 | | |
639 | 672 | | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
640 | 718 | | |
641 | 719 | | |
642 | 720 | | |
| |||
720 | 798 | | |
721 | 799 | | |
722 | 800 | | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
723 | 804 | | |
724 | 805 | | |
725 | 806 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
186 | 185 | | |
187 | 186 | | |
188 | 187 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
247 | 253 | | |
248 | 254 | | |
249 | 255 | | |
| |||
0 commit comments