Uploaded image for project: 'Maven Build Cache Extension'
  1. Maven Build Cache Extension
  2. MBUILDCACHE-24

Cache cannot be processed in presence of forked executions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.0.0
    • None

    Description

      Current implementation relies on lifecycle phases presence in 

      `MojoExecution`. In case of forked execution `MojoExecution#getLifecyclePhase` could return null which result in IAEs in multiples places in cache:

       

      java.lang.IllegalArgumentException: Unsupported phase: null
          at org.apache.maven.buildcache.LifecyclePhasesHelper.isLaterPhase (LifecyclePhasesHelper.java:121)
          at org.apache.maven.buildcache.LifecyclePhasesHelper.isLaterPhaseThanClean (LifecyclePhasesHelper.java:105)
          at org.apache.maven.buildcache.LifecyclePhasesHelper.getCleanSegment (LifecyclePhasesHelper.java:139)
          at org.apache.maven.buildcache.BuildCacheMojosExecutionStrategy.execute (BuildCacheMojosExecutionStrategy.java:101)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:153)
          at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions (MojoExecutor.java:366)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:211)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:167)
          at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:66)
          at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:158)
          at org.apache.maven.buildcache.BuildCacheMojosExecutionStrategy.execute (BuildCacheMojosExecutionStrategy.java:127)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:153)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
          at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:196)
          at org.apache.maven.lifecycle.internal.builder.multithreaded.MultiThreadedBuilder$1.call (MultiThreadedBuilder.java:186)
          at java.util.concurrent.FutureTask.run (FutureTask.java:266)
          at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:511)
          at java.util.concurrent.FutureTask.run (FutureTask.java:266)
          at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
       
      

      Proposed fix is to resolve `lifecyclePhase` from the originating mojo and use it as a lifecycle phase for forked mojos. 
      Optionally, the issue probably could be resolved in maven-core by properly setting execution phase. 

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              alex_ashitkin Alexander Ashitkin
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: