Class MappingUtils


  • public final class MappingUtils
    extends java.lang.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 $
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private MappingUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String evaluateFileNameMapping​(java.lang.String expression, org.apache.maven.artifact.Artifact artifact)
      Evaluates the specified expression for the given artifact.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_FILE_NAME_MAPPING

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

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

      • MappingUtils

        private MappingUtils()
    • Method Detail

      • evaluateFileNameMapping

        public static java.lang.String evaluateFileNameMapping​(java.lang.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.