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

Magic expressions injected by PluginParameterExpressionEvalutor conflict with expressions used by plugins to access system properties

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.10, 2.1.0, 2.2.1
    • 3.0-alpha-3
    • Plugins and Lifecycle
    • None

    Description

      Running "mvn package" on this POM snippet will crash:

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.2</version>
            <configuration>
              <encoding>${localRepository}</encoding>
            </configuration>
          </plugin>
        </plugins>
      </build>
      

      Output:

      [INFO] Failed to configure plugin parameters for: org.apache.maven.plugins:maven-resources-plugin:2.2
      
      Cause: Cannot assign value '[local] -> file://repo' to field:
      org.apache.maven.plugin.resources.ResourcesMojo.encoding;
      type: org.apache.maven.artifact.repository.DefaultArtifactRepository
      

      Although this exploit is rather artificial, it demonstrates the problem. We have never properly reserved certain parameter expressions for usage by the core to inject magic values. Last but not least, we occasionally extend the list of supported expressions in newer Maven versions. That means we're in a bad position to demand plugin authors to not use these expressions. Hence we need to gracefully handle plugins that use this magic expressions for ordinary system properties.

      The real-life example of this issue is MNG-3683, where the Help Plugin uses ${plugin} for a String-typed parameter but a new Maven version started to use this expression to inject the plugin descriptor.

      Attachments

        Issue Links

          Activity

            People

              bentmann Benjamin Bentmann
              bentmann Benjamin Bentmann
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: