Class MappingUtils


  • public final class MappingUtils
    extends Object

    Utilities used to evaluate an expression.

    The expression might use any field of the Artifact interface. Some examples might be:

    • @{artifactId}@-@{version}@@{dashClassifier?}@.@{extension}@
    • @{artifactId}@-@{version}@.@{extension}@
    • @{artifactId}@.@{extension}@

    Although parts of this code comes from the Assembly Plugin, it cannot be shared with the Assembly Plugin. The reason for this is that the Assembly Plugin always uses a prefix for the expressions, whereas this code does not.

    Version:
    $Id: MappingUtils.java 1714435 2015-11-15 11:55:21Z khmarbaise $
    Author:
    Stephane Nicoll, Dennis Lundberg
    • Field Detail

      • DEFAULT_FILE_NAME_MAPPING

        public static final String DEFAULT_FILE_NAME_MAPPING
        Default file name mapping.
        See Also:
        Constant Field Values
      • DEFAULT_FILE_NAME_MAPPING_CLASSIFIER

        public static final String DEFAULT_FILE_NAME_MAPPING_CLASSIFIER
        Default file name mapping incl. classifier.
        See Also:
        Constant Field Values
    • Method Detail

      • evaluateFileNameMapping

        public static String evaluateFileNameMapping​(String expression,
                                                     org.apache.maven.artifact.Artifact artifact)
                                              throws org.codehaus.plexus.interpolation.InterpolationException
        Evaluates the specified expression for the given artifact.
        Parameters:
        expression - the expression to evaluate
        artifact - the artifact to use as value object for tokens
        Returns:
        expression the evaluated expression
        Throws:
        org.codehaus.plexus.interpolation.InterpolationException - In case of an error.