Class DefaultModelPathTranslator

java.lang.Object
org.apache.maven.internal.impl.model.DefaultModelPathTranslator
All Implemented Interfaces:
ModelPathTranslator

@Named @Singleton public class DefaultModelPathTranslator extends Object implements ModelPathTranslator
Resolves relative paths within a model against a specific base directory.
  • Field Details

  • Constructor Details

  • Method Details

    • alignToBaseDirectory

      public Model alignToBaseDirectory(Model model, Path basedir, ModelBuilderRequest request)
      Description copied from interface: ModelPathTranslator
      Resolves the well-known paths of the specified model against the given base directory. Paths within plugin configuration are not processed.
      Specified by:
      alignToBaseDirectory in interface ModelPathTranslator
      Parameters:
      model - The model whose paths should be resolved, may be null.
      basedir - The base directory to resolve relative paths against, may be null.
      request - The model building request that holds further settings, must not be null.
    • map

      private <T> List<T> map(List<T> resources, Function<T,T> mapper)
    • alignToBaseDirectory

      private Resource alignToBaseDirectory(Resource resource, Path basedir)
      Returns a resource with all properties identical to the given resource, except the paths which are resolved according the given basedir. If the paths are unchanged, then this method returns the previous instance.
      Parameters:
      resource - the resource to relocate, or null
      basedir - the new base directory
      Returns:
      relocated resource, or null if the given resource was null
    • alignToBaseDirectory

      private String alignToBaseDirectory(String path, Path basedir)
      Returns a path relocated to the given base directory. If the result of this operation is the same path as before, then this method returns the old path instance. It is okay for the caller to compare the String instances using the identity comparator for detecting changes.
      Parameters:
      path - the path to relocate, or null
      basedir - the new base directory
      Returns:
      relocated path, or null if the given path was null