Class SystemPropertySaveEnvironmentFacet

  • All Implemented Interfaces:
    EnvironmentFacet

    public final class SystemPropertySaveEnvironmentFacet
    extends AbstractLogAwareFacet
    EnvironmentFacet which saves the value of a system property for the duration of executing a tool. This may be required for tools (such as the XJC tool) which may overwrite property values for its own purpose. Unlike SystemPropertyChangeEnvironmentFacet, this does not a set a new property value itself, just saves the old value and later restores or clears it. This facet accepts the key of the property to save.
    Since:
    2.5
    Author:
    Svein Elgstøen
    • Constructor Detail

      • SystemPropertySaveEnvironmentFacet

        public SystemPropertySaveEnvironmentFacet​(String key,
                                                  org.apache.maven.plugin.logging.Log log)
        Creates a SystemPropertySave which will remember the original value of the supplied system property for the duration of this SystemPropertySave.
        Parameters:
        key - A non-null key.
        log - The active Maven Log.
    • Method Detail

      • restore

        public void restore()
        Restores the original Environment, implying that the change performed in setup() method are restored to the state before the setup method was called.
      • setup

        public void setup()
        Sets up this Environment, inferring temporary changes to environment variables or conditions. The changes must be reversible, and should be restored to their original values in the restore() method.