Class BuildContextHolder

java.lang.Object
ro.isdc.wro.maven.plugin.support.BuildContextHolder

public class BuildContextHolder extends Object
Encapsulate the details about state persisted across multiple build runs. This class hides the details about the storage used to persist the data produced during a build. By default the BuildContext is used, but if it is not available - the alternate storage (a properties file stored in the file system) is used.
Since:
1.7.1
Author:
Alex Objelean
  • Constructor Details

    • BuildContextHolder

      public BuildContextHolder(org.sonatype.plexus.build.incremental.BuildContext buildContext, File buildDirectory)
      Parameters:
      buildContext - - The context provided by maven. If this is not provided, the default mechanism for persisting build data is used.
      buildDirectory - the folder where the build output is created. If this value is null, the temp folder will be used.
  • Method Details

    • getValue

      public String getValue(String key)
      Parameters:
      key - of the value to retrieve.
      Returns:
      the persisted value stored under the provided key. If no value exist, the returned result will be null.
    • setValue

      public void setValue(String key, String value)
      Parameters:
      key - to associate with the value to be persisted.
      value - to persist.
    • setIncrementalBuildEnabled

      public void setIncrementalBuildEnabled(boolean incrementalBuildEnabled)
    • isIncrementalBuild

      public boolean isIncrementalBuild()
      Returns:
      the flag indicating the incremental build change. A build is incremental, when the modified resources should be processed only. Useful to avoid unnecessary processing when there is actually no change detected.
    • destroy

      public void destroy()
      Destroy the persisted storage and all stored data.
    • persist

      public void persist()
      Persist the fallbackStorage to the fallbackStorageFile. This method should be invoked only once during build, since it is relatively expensive. Not invoking it, would break the incremental build feature.