Interface CacheController

All Known Implementing Classes:
CacheControllerImpl

public interface CacheController
CacheController
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    canRestoreForkedOutputs(CacheResult cacheResult, org.apache.maven.project.MavenProject project, List<org.apache.maven.plugin.MojoExecution> mojoExecutions)
    Tells whether a cache entry can put back the compiled output a forked lifecycle would otherwise build (typically target/classes and target/test-classes).
    findCachedBuild(org.apache.maven.execution.MavenSession session, org.apache.maven.project.MavenProject project, List<org.apache.maven.plugin.MojoExecution> mojoExecutions, boolean skipCache)
     
    boolean
    isForcedExecution(org.apache.maven.project.MavenProject project, org.apache.maven.plugin.MojoExecution execution)
     
     
    void
    restoreStagedArtifacts(org.apache.maven.execution.MavenSession session, org.apache.maven.project.MavenProject project)
    Restore staged artifacts after save() completes.
    void
    save(CacheResult cacheResult, List<org.apache.maven.plugin.MojoExecution> mojoExecutions, Map<String,org.apache.maven.execution.MojoExecutionEvent> executionEvents)
     
    void
    saveCacheReport(org.apache.maven.execution.MavenSession session)
     
    void
    stagePreExistingArtifacts(org.apache.maven.execution.MavenSession session, org.apache.maven.project.MavenProject project)
    Move pre-existing artifacts to staging directory to prevent caching stale files.
  • Method Details

    • findCachedBuild

      CacheResult findCachedBuild(org.apache.maven.execution.MavenSession session, org.apache.maven.project.MavenProject project, List<org.apache.maven.plugin.MojoExecution> mojoExecutions, boolean skipCache)
    • restoreProjectArtifacts

      ArtifactRestorationReport restoreProjectArtifacts(CacheResult cacheResult)
    • canRestoreForkedOutputs

      boolean canRestoreForkedOutputs(CacheResult cacheResult, org.apache.maven.project.MavenProject project, List<org.apache.maven.plugin.MojoExecution> mojoExecutions)
      Tells whether a cache entry can put back the compiled output a forked lifecycle would otherwise build (typically target/classes and target/test-classes). A forked goal such as jetty:run skips compilation on a cache hit, so if the entry only holds the final JAR the project would be left with no classes. Callers use this to only restore a fork when the classes are actually there.
      Parameters:
      cacheResult - the cache hit under consideration
      project - the (forked) project being built
      mojoExecutions - the mojos scheduled for the forked lifecycle (used to see which phases it reaches)
      Returns:
      true if the entry carries every compiled output directory the fork reaches
    • save

      void save(CacheResult cacheResult, List<org.apache.maven.plugin.MojoExecution> mojoExecutions, Map<String,org.apache.maven.execution.MojoExecutionEvent> executionEvents)
    • isForcedExecution

      boolean isForcedExecution(org.apache.maven.project.MavenProject project, org.apache.maven.plugin.MojoExecution execution)
    • saveCacheReport

      void saveCacheReport(org.apache.maven.execution.MavenSession session)
    • stagePreExistingArtifacts

      void stagePreExistingArtifacts(org.apache.maven.execution.MavenSession session, org.apache.maven.project.MavenProject project) throws IOException
      Move pre-existing artifacts to staging directory to prevent caching stale files. Called before mojos run to ensure save() only sees fresh files.
      Parameters:
      session - the Maven session
      project - the Maven project
      Throws:
      IOException - if file operations fail
    • restoreStagedArtifacts

      void restoreStagedArtifacts(org.apache.maven.execution.MavenSession session, org.apache.maven.project.MavenProject project)
      Restore staged artifacts after save() completes. Files that were rebuilt are discarded; files that weren't rebuilt are restored.
      Parameters:
      session - the Maven session
      project - the Maven project