Class PropertyUtils

java.lang.Object
org.apache.maven.shared.filtering.PropertyUtils

public final class PropertyUtils extends Object
Author:
Kenney Westerhof, William Ferguson
  • Method Details

    • loadPropertyFile

      public static Properties loadPropertyFile(File propFile, Properties baseProps) throws IOException
      Reads a property file, resolving all internal variables, using the supplied base properties.

      The properties are resolved iteratively, so if the value of property A refers to property B, then after resolution the value of property B will contain the value of property B.

      Parameters:
      propFile - The property file to load.
      baseProps - Properties containing the initial values to substitute into the properties file.
      Returns:
      Properties object containing the properties in the file with their values fully resolved.
      Throws:
      IOException - if profile does not exist, or cannot be read.
    • loadPropertyFile

      public static Properties loadPropertyFile(File propFile, Properties baseProps, org.slf4j.Logger logger) throws IOException
      Reads a property file, resolving all internal variables, using the supplied base properties.

      The properties are resolved iteratively, so if the value of property A refers to property B, then after resolution the value of property B will contain the value of property B.

      Parameters:
      propFile - The property file to load.
      baseProps - Properties containing the initial values to substitute into the properties file.
      logger - Logger instance
      Returns:
      Properties object containing the properties in the file with their values fully resolved.
      Throws:
      IOException - if profile does not exist, or cannot be read.
      Since:
      3.1.2
    • loadPropertyFile

      public static Properties loadPropertyFile(File propfile, boolean fail, boolean useSystemProps) throws IOException
      Reads a property file, resolving all internal variables.
      Parameters:
      propfile - The property file to load
      fail - whether to throw an exception when the file cannot be loaded or to return null
      useSystemProps - whether to incorporate System.getProperties settings into the returned Properties object.
      Returns:
      the loaded and fully resolved Properties object
      Throws:
      IOException - if profile does not exist, or cannot be read.
    • loadPropertyFile

      public static Properties loadPropertyFile(File propfile, boolean fail, boolean useSystemProps, org.slf4j.Logger logger) throws IOException
      Reads a property file, resolving all internal variables.
      Parameters:
      propfile - The property file to load
      fail - whether to throw an exception when the file cannot be loaded or to return null
      useSystemProps - whether to incorporate System.getProperties settings into the returned Properties object.
      logger - Logger instance
      Returns:
      the loaded and fully resolved Properties object
      Throws:
      IOException - if profile does not exist, or cannot be read.
      Since:
      3.1.2