[ 
https://issues.apache.org/jira/browse/MBUILDCACHE-105?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17876885#comment-17876885
 ] 

ASF GitHub Bot commented on MBUILDCACHE-105:
--------------------------------------------

AlexanderAshitkin commented on code in PR #176:
URL: 
https://github.com/apache/maven-build-cache-extension/pull/176#discussion_r1732039886


##########
src/main/java/org/apache/maven/buildcache/CacheControllerImpl.java:
##########
@@ -255,6 +255,11 @@ private CacheResult analyzeResult(CacheContext context, 
List<MojoExecution> mojo
                         build.getCacheImplementationVersion());
             }
 
+            if (lifecyclePhasesHelper.isLaterPhaseThanBuild("package", build)) 
{
+                LOGGER.warn("Cached build doesn't include phase 'package', 
cannot restore");

Review Comment:
   The expected behavior is that when two consecutive 'mvn compile' commands 
are used, the second 'mvn compile' should use the cache. I'm concerned that 
this implementation might lead to a performance regression. A more accurate 
implementation would be to always attach the generated sources in `save` and 
process partial success more accurately.
   
   In the current implementation, the 'analyzeResult' returns partial success 
here (see lines 277-278) as expected. The fix should be made in the partial 
success processing logic. A build without a package phase should restore 
generated sources only and rerun all the missing lifecycle phases to build 
artifacts.





> Executing 'clean process-test-classes'  then 'clean verify' leads to empty 
> jars
> -------------------------------------------------------------------------------
>
>                 Key: MBUILDCACHE-105
>                 URL: https://issues.apache.org/jira/browse/MBUILDCACHE-105
>             Project: Maven Build Cache Extension
>          Issue Type: Bug
>            Reporter: Réda Housni Alaoui
>            Priority: Major
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to