Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-5445

Missing PathTranslator @Requirement in org.apache.maven.project.interpolation.StringSearchModelInterpolator

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.4
    • 3.1.0-alpha-1
    • None
    • None
    • Patch

    Description

      In Maven 2.2.1 the StringSearchModelInterpolator component had an explicit PathTranslator requirement defined in the following components.xml:

      https://github.com/apache/maven/blob/maven-2.2.1/maven-project/src/main/resources/META-INF/plexus/components.xml#L53

      In Maven 3.x this component became part of the maven-compat module, and while other components had their XML requirements turned into @Requirement annotations, this was not done for the PathTranslator field declared in StringSearchModelInterpolator's superclass:

      https://github.com/apache/maven/blob/master/maven-compat/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java#L91

      This is the root cause of https://jira.codehaus.org/browse/MVERSIONS-205

      Suggested patch:

      diff --git a/maven-project/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java b/maven-project/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java
      index c77aebd..2190267 100644
      --- a/maven-project/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java
      +++ b/maven-project/src/main/java/org/apache/maven/project/interpolation/AbstractStringBasedModelInterpolator.java
      @@ -25,6 +25,7 @@ import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
       import org.apache.maven.project.DefaultProjectBuilderConfiguration;
       import org.apache.maven.project.ProjectBuilderConfiguration;
       import org.apache.maven.project.path.PathTranslator;
      +import org.codehaus.plexus.component.annotations.Requirement;
       import org.codehaus.plexus.interpolation.AbstractValueSource;
       import org.codehaus.plexus.interpolation.InterpolationException;
       import org.codehaus.plexus.interpolation.InterpolationPostProcessor;
      @@ -88,6 +89,7 @@ public abstract class AbstractStringBasedModelInterpolator
               TRANSLATED_PATH_EXPRESSIONS = translatedPrefixes;
           }
       
      +    @Requirement
           private PathTranslator pathTranslator;
           
           private Interpolator interpolator;
      

      Attachments

        Activity

          People

            olamy Olivier Lamy
            mcculls Stuart McCulloch
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: